This commit is contained in:
Andras Schmelczer 2019-09-07 21:17:34 +02:00
commit 3101c973eb
2 changed files with 113 additions and 97 deletions

View file

@ -6,8 +6,6 @@ import { Serializable } from '../model/serializable';
import { Tower } from '../model/tower';
import { Block } from '../model/block';
import { IPage } from '../interfaces/persistance/page';
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
import { Observable } from 'rxjs/internal/Observable';
@Injectable({
providedIn: 'root'
@ -61,11 +59,14 @@ export class DataService extends Root<Page> {
childrenType: null
}
};
this.children$.subscribe(value => {
this.children$.subscribe(_ => {
this.log();
this.save(0);
});
this.addChildren(pages.map(p => new Page(p)));
this.children$.subscribe(_ => {
this.save(0);
});
}
}

View file

@ -95,7 +95,7 @@ export class StoreService<T> {
constructor() {
const localStorageData = localStorage.getItem(LOCAL_STORAGE_KEY);
this.storedData = JSON.parse(false ? localStorageData : this.mockData) as T;
this.storedData = JSON.parse(localStorageData ? localStorageData : this.mockData) as T;
}
scheduleSave(data: T, timeout: number) {