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() {
|
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() {
|
async getItems() {
|
||||||
@@ -78,14 +82,16 @@ export class LibraryAccountService {
|
|||||||
return this.performRequest<PAIAFees>(`${this.baseUrl}/{patron}/fees`);
|
return this.performRequest<PAIAFees>(`${this.baseUrl}/{patron}/fees`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getValidToken() {
|
||||||
|
return this.authHelper.getProvider(this.authType).getValidToken();
|
||||||
|
}
|
||||||
|
|
||||||
private async performRequest<T>(
|
private async performRequest<T>(
|
||||||
urlTemplate: string,
|
urlTemplate: string,
|
||||||
method = 'GET',
|
method = 'GET',
|
||||||
data?: JQuery.PlainObject,
|
data?: JQuery.PlainObject,
|
||||||
): Promise<T | undefined> {
|
): Promise<T | undefined> {
|
||||||
const token = await this.authHelper
|
const token = await this.getValidToken();
|
||||||
.getProvider(this.authType)
|
|
||||||
.getValidToken();
|
|
||||||
const url = urlTemplate.replace(
|
const url = urlTemplate.replace(
|
||||||
'{patron}',
|
'{patron}',
|
||||||
(token as PAIATokenResponse).patron,
|
(token as PAIATokenResponse).patron,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class ProfilePageComponent {
|
|||||||
patron?: PAIAPatron;
|
patron?: PAIAPatron;
|
||||||
|
|
||||||
propertiesToShow: (keyof PAIAPatron)[] = [
|
propertiesToShow: (keyof PAIAPatron)[] = [
|
||||||
|
'id',
|
||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
'address',
|
'address',
|
||||||
|
|||||||
@@ -25,7 +25,18 @@
|
|||||||
{{ patron[property] }}
|
{{ patron[property] }}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template #date>
|
<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>
|
</ng-template>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export interface PAIAPatron {
|
export interface PAIAPatron {
|
||||||
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email?: string;
|
email?: string;
|
||||||
address?: string;
|
address?: string;
|
||||||
|
|||||||
@@ -253,14 +253,18 @@
|
|||||||
"profile": {
|
"profile": {
|
||||||
"title": "Deine persönlichen Daten",
|
"title": "Deine persönlichen Daten",
|
||||||
"labels": {
|
"labels": {
|
||||||
"id": "Nutzer-ID",
|
"id": "Bibliotheksausweisnummer",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"email": "E-Mail",
|
"email": "E-Mail",
|
||||||
"address": "Adresse",
|
"address": "Adresse",
|
||||||
"expires": "Nutzungsberechtigung endet am",
|
"expires": "Nutzungsberechtigung",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"type": "Typ",
|
"type": "Typ",
|
||||||
"note": "Nachricht"
|
"note": "Nachricht"
|
||||||
|
},
|
||||||
|
"values": {
|
||||||
|
"unlimited": "unbefristet",
|
||||||
|
"expires": "endet am"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"holds": {
|
"holds": {
|
||||||
|
|||||||
@@ -253,14 +253,18 @@
|
|||||||
"profile": {
|
"profile": {
|
||||||
"title": "library profile",
|
"title": "library profile",
|
||||||
"labels": {
|
"labels": {
|
||||||
"id": "User ID",
|
"id": "Card number",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"address": "Address",
|
"address": "Address",
|
||||||
"expires": "Membership expires",
|
"expires": "Membership",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"note": "Note"
|
"note": "Note"
|
||||||
|
},
|
||||||
|
"values": {
|
||||||
|
"unlimited": "unlimited",
|
||||||
|
"expires": "expires"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"holds": {
|
"holds": {
|
||||||
|
|||||||
Reference in New Issue
Block a user