diff --git a/src/app/modules/library/account/library-account.service.ts b/src/app/modules/library/account/library-account.service.ts index 77b3b3af..8de44ad0 100644 --- a/src/app/modules/library/account/library-account.service.ts +++ b/src/app/modules/library/account/library-account.service.ts @@ -67,7 +67,11 @@ export class LibraryAccountService { } async getProfile() { - return this.performRequest(`${this.baseUrl}/{patron}`); + const patron = ((await this.getValidToken()) as PAIATokenResponse).patron; + return { + ...(await this.performRequest(`${this.baseUrl}/{patron}`)), + id: patron, + } as PAIAPatron; } async getItems() { @@ -78,14 +82,16 @@ export class LibraryAccountService { return this.performRequest(`${this.baseUrl}/{patron}/fees`); } + async getValidToken() { + return this.authHelper.getProvider(this.authType).getValidToken(); + } + private async performRequest( urlTemplate: string, method = 'GET', data?: JQuery.PlainObject, ): Promise { - const token = await this.authHelper - .getProvider(this.authType) - .getValidToken(); + const token = await this.getValidToken(); const url = urlTemplate.replace( '{patron}', (token as PAIATokenResponse).patron, diff --git a/src/app/modules/library/account/profile/profile-page.component.ts b/src/app/modules/library/account/profile/profile-page.component.ts index e048a5c3..f5609dc5 100644 --- a/src/app/modules/library/account/profile/profile-page.component.ts +++ b/src/app/modules/library/account/profile/profile-page.component.ts @@ -11,6 +11,7 @@ export class ProfilePageComponent { patron?: PAIAPatron; propertiesToShow: (keyof PAIAPatron)[] = [ + 'id', 'name', 'email', 'address', diff --git a/src/app/modules/library/account/profile/profile-page.html b/src/app/modules/library/account/profile/profile-page.html index 8ad9c9df..ceae20a4 100644 --- a/src/app/modules/library/account/profile/profile-page.html +++ b/src/app/modules/library/account/profile/profile-page.html @@ -25,7 +25,18 @@ {{ patron[property] }} - {{ patron[property] | amDateFormat: 'll' }} + + {{ + 'library.account.pages.profile.values.unlimited' | translate + }} + + + {{ + 'library.account.pages.profile.values.expires' | translate + }}: {{ patron[property] | amDateFormat: 'll' }} + diff --git a/src/app/modules/library/types.ts b/src/app/modules/library/types.ts index 806395ee..562fad3c 100644 --- a/src/app/modules/library/types.ts +++ b/src/app/modules/library/types.ts @@ -14,6 +14,7 @@ */ export interface PAIAPatron { + id: string; name: string; email?: string; address?: string; diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 152db289..a33b8bfb 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -253,14 +253,18 @@ "profile": { "title": "Deine persönlichen Daten", "labels": { - "id": "Nutzer-ID", + "id": "Bibliotheksausweisnummer", "name": "Name", "email": "E-Mail", "address": "Adresse", - "expires": "Nutzungsberechtigung endet am", + "expires": "Nutzungsberechtigung", "status": "Status", "type": "Typ", "note": "Nachricht" + }, + "values": { + "unlimited": "unbefristet", + "expires": "endet am" } }, "holds": { diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index f9d84291..c1743c69 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -253,14 +253,18 @@ "profile": { "title": "library profile", "labels": { - "id": "User ID", + "id": "Card number", "name": "Name", "email": "Email", "address": "Address", - "expires": "Membership expires", + "expires": "Membership", "status": "Status", "type": "Type", "note": "Note" + }, + "values": { + "unlimited": "unlimited", + "expires": "expires" } }, "holds": {