mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { localstoreService } from './localstore.service'
|
|
import { AES, enc, SHA1 } from 'crypto-js'
|
|
import { Publication } from 'src/app/models/publication';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class PresidentialActionsStoreService {
|
|
|
|
// main data
|
|
private _list: Publication[] = []
|
|
// local storage keyName
|
|
private keyName: string;
|
|
|
|
constructor() {
|
|
|
|
this.keyName = (SHA1("PresidentialActionsStoreService"+ 'presidentialActions/local')).toString()
|
|
|
|
setTimeout(()=>{
|
|
let restore = localstoreService.get(this.keyName, [])
|
|
this._list = restore.list
|
|
}, 10)
|
|
|
|
}
|
|
|
|
get list() {
|
|
return this._list
|
|
}
|
|
|
|
reset(list: Publication[]) {
|
|
this._list = list
|
|
|
|
this.save(this._list)
|
|
if(window['all-process-gabinete']) {
|
|
window['all-process-gabinete']()
|
|
}
|
|
}
|
|
|
|
private save(list: Publication[]) {
|
|
setTimeout(()=> {
|
|
localstoreService.set(this.keyName, {
|
|
list: this._list
|
|
})
|
|
}, 10)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
export const PresidentialActionsStore = new PresidentialActionsStoreService()
|