-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-data.ts
48 lines (41 loc) · 1.23 KB
/
api-data.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { BaseAuthData, BaseRole, BaseToken, LoginData } from 'projects/ngx-material-auth/src/public-api';
/* eslint-disable jsdoc/require-jsdoc */
export enum Roles {
USER = 'user',
ADMIN = 'admin'
}
export interface CustomToken extends BaseToken {
additionalValue: string
}
export interface CustomAuthData extends BaseAuthData<CustomToken, Roles, BaseRole<Roles>> {
superUser: boolean
}
export const correctLoginData: LoginData = {
email: '[email protected]',
// eslint-disable-next-line cspell/spellchecker
password: 'stringstring'
};
export const authData: CustomAuthData = {
userId: '1',
roles: [{
displayName: 'User',
value: Roles.USER
}],
refreshToken: {
expirationDate: new Date(),
value: 'refresh.token.value',
additionalValue: 'additional value'
},
superUser: true,
accessToken: {
expirationDate: new Date(),
value: 'access.token.value',
additionalValue: 'additional value'
}
};
export function refreshAccessToken(): void {
authData.accessToken.expirationDate = new Date(Date.now() + 3600000);
}
export function refreshRefreshToken(): void {
authData.refreshToken.expirationDate = new Date(Date.now() + 8640000000);
}