diff --git a/web/store/dataMaps/index.ts b/web/store/dataMaps/index.ts index f944843e3..2dde5613b 100644 --- a/web/store/dataMaps/index.ts +++ b/web/store/dataMaps/index.ts @@ -1,10 +1,10 @@ import { IWorkspaceData, WorkspaceData } from "./workspace.data.store"; export class DataStore { - workspaceData: IWorkspaceData; + workspace: IWorkspaceData; constructor() { - this.workspaceData = new WorkspaceData(this); + this.workspace = new WorkspaceData(this); } resetOnSignout() {} diff --git a/web/store/dataMaps/workspace.data.store.ts b/web/store/dataMaps/workspace.data.store.ts index a6c93bf13..7db350729 100644 --- a/web/store/dataMaps/workspace.data.store.ts +++ b/web/store/dataMaps/workspace.data.store.ts @@ -1,5 +1,5 @@ import { makeObservable, observable } from "mobx"; -import { WorkspaceModel } from "store/workspace.model"; +import { WorkspaceModel } from "store/workspace.store"; import { DataStore } from "."; import { IWorkspace } from "@plane/types"; import { set } from "lodash"; diff --git a/web/store/root.store.ts b/web/store/root.store.ts index 60e718aa6..d9dd18a82 100644 --- a/web/store/root.store.ts +++ b/web/store/root.store.ts @@ -1,5 +1,5 @@ import { DataStore } from "./dataMaps"; -import { IUserModel, UserModel } from "./user.model"; +import { IUserModel, UserModel } from "./user.store"; export class RootStore { data: DataStore; diff --git a/web/store/user.model.ts b/web/store/user.store.ts similarity index 77% rename from web/store/user.model.ts rename to web/store/user.store.ts index 72ab984f7..13a06c769 100644 --- a/web/store/user.model.ts +++ b/web/store/user.store.ts @@ -3,7 +3,7 @@ import { WorkspaceService } from "services/workspace.service"; import set from "lodash/set"; import { IWorkspace } from "@plane/types"; import { DataStore } from "./dataMaps"; -import { IWorkspaceModel } from "./workspace.model"; +import { IWorkspaceModel } from "./workspace.store"; export interface IUserModel { workspaces: Record; @@ -13,15 +13,15 @@ export class UserModel implements IUserModel { workspaces: Record = {}; // data store - dataStore; + data; // services workspaceService; - constructor(_dataStore: DataStore) { + constructor(_data: DataStore) { makeObservable(this, { workspaces: observable, }); - this.dataStore = _dataStore; + this.data = _data; this.workspaceService = new WorkspaceService(); } @@ -38,10 +38,10 @@ export class UserModel implements IUserModel { fetchWorkspaces = async () => { const workspaceResponse = await this.workspaceService.userWorkspaces(); - this.dataStore.workspaceData.addWorkspaces(workspaceResponse); + this.data.workspace.addWorkspaces(workspaceResponse); runInAction(() => { workspaceResponse.forEach((workspace) => { - set(this.workspaces, [workspace.id], this.dataStore.workspaceData.workspaceMap[workspace.id]); + set(this.workspaces, [workspace.id], this.data.workspace.workspaceMap[workspace.id]); }); }); return workspaceResponse; @@ -53,9 +53,9 @@ export class UserModel implements IUserModel { */ createWorkspace = async (data: Partial) => await this.workspaceService.createWorkspace(data).then((response) => { - this.dataStore.workspaceData.addWorkspaces([response]); + this.data.workspace.addWorkspaces([response]); runInAction(() => { - set(this.workspaces, [response.id], this.dataStore.workspaceData.workspaceMap[response.id]); + set(this.workspaces, [response.id], this.data.workspace.workspaceMap[response.id]); }); return response; }); @@ -68,7 +68,7 @@ export class UserModel implements IUserModel { await this.workspaceService.deleteWorkspace(workspaceSlug).then(() => { const updatedWorkspacesList = this.workspaces; const workspaceId = this.getWorkspaceBySlug(workspaceSlug)?.id; - this.dataStore.workspaceData.deleteWorkspace(`${workspaceId}`); + this.data.workspace.deleteWorkspace(`${workspaceId}`); runInAction(() => { delete updatedWorkspacesList[`${workspaceId}`]; }); diff --git a/web/store/workspace.model.ts b/web/store/workspace.store.ts similarity index 100% rename from web/store/workspace.model.ts rename to web/store/workspace.store.ts