diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 538a62a75..9afb29e84 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -142,9 +142,14 @@ }, "apiTokens": { "title": "API Tokens", - "general": "API tokens allow you to use Vikunja's api without user credentials.", + "general": "API tokens allow you to use Vikunja's API without user credentials.", "apiDocs": "Check out the api docs", - "createToken": "Create a token", + "createAToken": "Create a token", + "createToken": "Create token", + "30d": "30 Days", + "60d": "60 Days", + "90d": "90 Days", + "permissionExplanation": "Permissions allow you to scope what an api token is allowed to do.", "attributes": { "title": "Title", "expiresAt": "Expires at", diff --git a/src/modelTypes/IApiToken.ts b/src/modelTypes/IApiToken.ts index 842e242ad..ce2627b63 100644 --- a/src/modelTypes/IApiToken.ts +++ b/src/modelTypes/IApiToken.ts @@ -10,4 +10,4 @@ export interface IApiToken extends IAbstract { permissions: IApiPermission expiresAt: Date created: Date -} \ No newline at end of file +} diff --git a/src/models/apiTokenModel.ts b/src/models/apiTokenModel.ts index dc3d69f17..8bcc277ca 100644 --- a/src/models/apiTokenModel.ts +++ b/src/models/apiTokenModel.ts @@ -8,7 +8,7 @@ export default class ApiTokenModel extends AbstractModel { expiresAt: Date = null created: Date = null - constructor(data: Partial) { + constructor(data: Partial = {}) { super() this.assignData(data) diff --git a/src/services/apiToken.ts b/src/services/apiToken.ts index 5c29370e3..ade111970 100644 --- a/src/services/apiToken.ts +++ b/src/services/apiToken.ts @@ -22,4 +22,15 @@ export default class ApiTokenService extends AbstractService { modelFactory(data: Partial) { return new ApiTokenModel(data) } + + async getAvailableRoutes() { + const cancel = this.setLoading() + + try { + const response = await this.http.get('/routes') + return response.data + } finally { + cancel() + } + } } \ No newline at end of file diff --git a/src/views/user/settings/ApiTokens.vue b/src/views/user/settings/ApiTokens.vue index 2ae763f0c..685ed5d72 100644 --- a/src/views/user/settings/ApiTokens.vue +++ b/src/views/user/settings/ApiTokens.vue @@ -1,34 +1,78 @@ - - \ No newline at end of file