Files
doneit-web/src/app/store/documentManagement.ts
T

46 lines
990 B
TypeScript
Raw Normal View History

2023-07-06 13:01:51 +01:00
import { SHA1 } from 'crypto-js'
import { localstoreService } from './localstore.service'
2023-07-06 13:17:36 +01:00
class _DocumentManagementStore {
2023-07-06 13:01:51 +01:00
2023-07-06 13:17:36 +01:00
session: {
2023-07-06 13:01:51 +01:00
UserId: number,
Email: string,
UserName: string
FullName: string
RoleID: number
RoleDescription: string
OrganicEntityID: number
OrganicEntityName: string
Status: string
Authorization: string
AuthorizationJwt: string
}
2023-07-06 13:17:36 +01:00
constructor() {
2023-07-06 13:35:11 +01:00
const restore = localstoreService.get(this.keyName, {})
this.session = restore.session
2023-07-06 13:17:36 +01:00
}
get keyName() {
2023-07-06 13:01:51 +01:00
return SHA1("documentManagement").toString()
}
2023-07-06 13:17:36 +01:00
setData(data) {
2023-07-06 13:01:51 +01:00
this.session = data
localstoreService.set(this.keyName, {
2023-07-06 13:17:36 +01:00
session: this.session
2023-07-06 13:01:51 +01:00
})
}
2023-07-06 13:17:36 +01:00
clear() {
2023-07-06 13:01:51 +01:00
delete this.session
localstoreService.delete(this.keyName)
}
2023-07-06 13:17:36 +01:00
}
export const DocumentManagementStore = new _DocumentManagementStore()