mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { eventSource } from '../models/agenda/eventSource';
|
||||
import { SHA1, SHA256, AES, enc } from 'crypto-js'
|
||||
import { LocalstoreService } from './localstore.service'
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { EventList, EventListStore } from '../models/agenda/AgendaEventList';
|
||||
|
||||
@Injectable({
|
||||
@@ -12,12 +12,14 @@ export class CalendarService {
|
||||
|
||||
private _eventSource : EventListStore[] = []
|
||||
private keyName: string;
|
||||
|
||||
localstoreService = localstoreService
|
||||
|
||||
constructor(private localstoreService: LocalstoreService) {
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'eventSource')).toString()
|
||||
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
let restore = this.localstoreService.get(this.keyName, [])
|
||||
|
||||
setTimeout(()=>{
|
||||
restore.forEach((element:EventListStore, eventIndex) => {
|
||||
@@ -46,7 +48,7 @@ export class CalendarService {
|
||||
}
|
||||
|
||||
get eventSource() {
|
||||
return this._eventSource
|
||||
return this._eventSource || []
|
||||
}
|
||||
|
||||
|
||||
@@ -93,4 +95,11 @@ export class CalendarService {
|
||||
}, 10)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete() {
|
||||
this._eventSource = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const CalendarStore = new CalendarService()
|
||||
Reference in New Issue
Block a user