mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
new session service
This commit is contained in:
@@ -1,45 +1,31 @@
|
||||
import { SHA1 } from 'crypto-js'
|
||||
import { localstoreService } from './localstore.service'
|
||||
|
||||
class _DocumentManagementStore {
|
||||
|
||||
|
||||
session: {
|
||||
UserId: number,
|
||||
Email: string,
|
||||
UserName: string
|
||||
FullName: string
|
||||
RoleID: number
|
||||
RoleDescription: string
|
||||
OrganicEntityID: number
|
||||
OrganicEntityName: string
|
||||
Status: string
|
||||
Authorization: string
|
||||
AuthorizationJwt: string
|
||||
}
|
||||
|
||||
|
||||
constructor() {
|
||||
const restore = localstoreService.get(this.keyName, {})
|
||||
this.session = restore.session
|
||||
}
|
||||
|
||||
get keyName() {
|
||||
return SHA1("documentManagement").toString()
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
this.session = data
|
||||
localstoreService.set(this.keyName, {
|
||||
session: this.session
|
||||
})
|
||||
}
|
||||
|
||||
clear() {
|
||||
delete this.session
|
||||
localstoreService.delete(this.keyName)
|
||||
}
|
||||
import { models } from 'src/plugin/src/'
|
||||
import { DELETE, GET, SAVE } from '../models/beast-orm-function';
|
||||
const { rewriteSave, rewriteGet, rewriteDelete } = models.core.localStorage.rewrite
|
||||
|
||||
export class CPSession extends models.LocalStorage {
|
||||
static UserId: number = models.preset()
|
||||
static Email: string = models.preset()
|
||||
static UserName: string = models.preset()
|
||||
static FullName: string = models.preset()
|
||||
static RoleID: number = models.preset()
|
||||
static RoleDescription: string = models.preset()
|
||||
static OrganicEntityID: number = models.preset()
|
||||
static OrganicEntityName: string = models.preset()
|
||||
static Status: string = models.preset()
|
||||
static Authorization: string = models.preset()
|
||||
static AuthorizationJwt: string = models.preset()
|
||||
}
|
||||
|
||||
export const DocumentManagementStore = new _DocumentManagementStore()
|
||||
// content production
|
||||
models.migrate({
|
||||
databaseName:'content-production',
|
||||
type: 'localStorage',
|
||||
version: 1,
|
||||
models: [CPSession],
|
||||
})
|
||||
|
||||
|
||||
rewriteGet.connect(GET, [CPSession])
|
||||
rewriteSave.connect(SAVE, [CPSession])
|
||||
rewriteDelete.connect(DELETE, [CPSession])
|
||||
CPSession.get()
|
||||
Reference in New Issue
Block a user