mirror of
https://github.com/makeplane/plane.git
synced 2026-02-24 20:20:49 +01:00
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import { enableStaticRendering } from "mobx-react";
|
|
// stores
|
|
import type { IInstanceStore } from "./instance.store";
|
|
import { InstanceStore } from "./instance.store";
|
|
import type { IThemeStore } from "./theme.store";
|
|
import { ThemeStore } from "./theme.store";
|
|
import type { IUserStore } from "./user.store";
|
|
import { UserStore } from "./user.store";
|
|
import type { IWorkspaceStore } from "./workspace.store";
|
|
import { WorkspaceStore } from "./workspace.store";
|
|
|
|
enableStaticRendering(typeof window === "undefined");
|
|
|
|
export class RootStore {
|
|
theme: IThemeStore;
|
|
instance: IInstanceStore;
|
|
user: IUserStore;
|
|
workspace: IWorkspaceStore;
|
|
|
|
constructor() {
|
|
this.theme = new ThemeStore(this);
|
|
this.instance = new InstanceStore(this);
|
|
this.user = new UserStore(this);
|
|
this.workspace = new WorkspaceStore(this);
|
|
}
|
|
|
|
hydrate(initialData: any) {
|
|
this.theme.hydrate(initialData.theme);
|
|
this.instance.hydrate(initialData.instance);
|
|
this.user.hydrate(initialData.user);
|
|
this.workspace.hydrate(initialData.workspace);
|
|
}
|
|
|
|
resetOnSignOut() {
|
|
localStorage.setItem("theme", "system");
|
|
this.instance = new InstanceStore(this);
|
|
this.user = new UserStore(this);
|
|
this.theme = new ThemeStore(this);
|
|
this.workspace = new WorkspaceStore(this);
|
|
}
|
|
}
|