mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
@@ -67,7 +67,11 @@ export class LibraryAccountService {
|
||||
}
|
||||
|
||||
async getProfile() {
|
||||
return this.performRequest<PAIAPatron>(`${this.baseUrl}/{patron}`);
|
||||
const patron = ((await this.getValidToken()) as PAIATokenResponse).patron;
|
||||
return {
|
||||
...(await this.performRequest<PAIAPatron>(`${this.baseUrl}/{patron}`)),
|
||||
id: patron,
|
||||
} as PAIAPatron;
|
||||
}
|
||||
|
||||
async getItems() {
|
||||
@@ -78,14 +82,16 @@ export class LibraryAccountService {
|
||||
return this.performRequest<PAIAFees>(`${this.baseUrl}/{patron}/fees`);
|
||||
}
|
||||
|
||||
async getValidToken() {
|
||||
return this.authHelper.getProvider(this.authType).getValidToken();
|
||||
}
|
||||
|
||||
private async performRequest<T>(
|
||||
urlTemplate: string,
|
||||
method = 'GET',
|
||||
data?: JQuery.PlainObject,
|
||||
): Promise<T | undefined> {
|
||||
const token = await this.authHelper
|
||||
.getProvider(this.authType)
|
||||
.getValidToken();
|
||||
const token = await this.getValidToken();
|
||||
const url = urlTemplate.replace(
|
||||
'{patron}',
|
||||
(token as PAIATokenResponse).patron,
|
||||
|
||||
@@ -11,6 +11,7 @@ export class ProfilePageComponent {
|
||||
patron?: PAIAPatron;
|
||||
|
||||
propertiesToShow: (keyof PAIAPatron)[] = [
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'address',
|
||||
|
||||
@@ -25,7 +25,18 @@
|
||||
{{ patron[property] }}
|
||||
</ng-container>
|
||||
<ng-template #date>
|
||||
{{ patron[property] | amDateFormat: 'll' }}
|
||||
<ng-container
|
||||
*ngIf="patron[property] === '9999-12-31'; else exactDate"
|
||||
>
|
||||
{{
|
||||
'library.account.pages.profile.values.unlimited' | translate
|
||||
}}
|
||||
</ng-container>
|
||||
<ng-template #exactDate>
|
||||
{{
|
||||
'library.account.pages.profile.values.expires' | translate
|
||||
}}: {{ patron[property] | amDateFormat: 'll' }}
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
export interface PAIAPatron {
|
||||
id: string;
|
||||
name: string;
|
||||
email?: string;
|
||||
address?: string;
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user