forked from Yadro/time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootStore.ts
More file actions
31 lines (25 loc) · 790 Bytes
/
RootStore.ts
File metadata and controls
31 lines (25 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import TaskStore from './tasks/TaskStore';
import ProjectStore from './projects/ProjectStore';
import ProjectModel from './projects/models/ProjectModel';
import SettingsStore from './settings/SettingsStore';
export class RootStore {
settingsStore = new SettingsStore(this);
tasksStore = new TaskStore(this);
projectStore = new ProjectStore(this);
restore() {
this.settingsStore.restore();
this.tasksStore.restore();
this.projectStore.restore();
}
loadTaskAndProjects() {
this.tasksStore.restore();
this.projectStore.restore();
}
deleteProject(project: ProjectModel) {
this.tasksStore.deleteProjectTasks(project.key);
this.projectStore.delete(project);
}
}
const rootStore = new RootStore();
rootStore.restore();
export default rootStore;