mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix minor store renames
This commit is contained in:
parent
a2ba369114
commit
86e952eb1f
@ -1,10 +1,10 @@
|
|||||||
import { IWorkspaceData, WorkspaceData } from "./workspace.data.store";
|
import { IWorkspaceData, WorkspaceData } from "./workspace.data.store";
|
||||||
|
|
||||||
export class DataStore {
|
export class DataStore {
|
||||||
workspaceData: IWorkspaceData;
|
workspace: IWorkspaceData;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.workspaceData = new WorkspaceData(this);
|
this.workspace = new WorkspaceData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetOnSignout() {}
|
resetOnSignout() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { makeObservable, observable } from "mobx";
|
import { makeObservable, observable } from "mobx";
|
||||||
import { WorkspaceModel } from "store/workspace.model";
|
import { WorkspaceModel } from "store/workspace.store";
|
||||||
import { DataStore } from ".";
|
import { DataStore } from ".";
|
||||||
import { IWorkspace } from "@plane/types";
|
import { IWorkspace } from "@plane/types";
|
||||||
import { set } from "lodash";
|
import { set } from "lodash";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DataStore } from "./dataMaps";
|
import { DataStore } from "./dataMaps";
|
||||||
import { IUserModel, UserModel } from "./user.model";
|
import { IUserModel, UserModel } from "./user.store";
|
||||||
|
|
||||||
export class RootStore {
|
export class RootStore {
|
||||||
data: DataStore;
|
data: DataStore;
|
||||||
|
@ -3,7 +3,7 @@ import { WorkspaceService } from "services/workspace.service";
|
|||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
import { IWorkspace } from "@plane/types";
|
import { IWorkspace } from "@plane/types";
|
||||||
import { DataStore } from "./dataMaps";
|
import { DataStore } from "./dataMaps";
|
||||||
import { IWorkspaceModel } from "./workspace.model";
|
import { IWorkspaceModel } from "./workspace.store";
|
||||||
|
|
||||||
export interface IUserModel {
|
export interface IUserModel {
|
||||||
workspaces: Record<string, IWorkspaceModel>;
|
workspaces: Record<string, IWorkspaceModel>;
|
||||||
@ -13,15 +13,15 @@ export class UserModel implements IUserModel {
|
|||||||
workspaces: Record<string, IWorkspaceModel> = {};
|
workspaces: Record<string, IWorkspaceModel> = {};
|
||||||
|
|
||||||
// data store
|
// data store
|
||||||
dataStore;
|
data;
|
||||||
// services
|
// services
|
||||||
workspaceService;
|
workspaceService;
|
||||||
|
|
||||||
constructor(_dataStore: DataStore) {
|
constructor(_data: DataStore) {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
workspaces: observable,
|
workspaces: observable,
|
||||||
});
|
});
|
||||||
this.dataStore = _dataStore;
|
this.data = _data;
|
||||||
this.workspaceService = new WorkspaceService();
|
this.workspaceService = new WorkspaceService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,10 +38,10 @@ export class UserModel implements IUserModel {
|
|||||||
fetchWorkspaces = async () => {
|
fetchWorkspaces = async () => {
|
||||||
const workspaceResponse = await this.workspaceService.userWorkspaces();
|
const workspaceResponse = await this.workspaceService.userWorkspaces();
|
||||||
|
|
||||||
this.dataStore.workspaceData.addWorkspaces(workspaceResponse);
|
this.data.workspace.addWorkspaces(workspaceResponse);
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
workspaceResponse.forEach((workspace) => {
|
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;
|
return workspaceResponse;
|
||||||
@ -53,9 +53,9 @@ export class UserModel implements IUserModel {
|
|||||||
*/
|
*/
|
||||||
createWorkspace = async (data: Partial<IWorkspace>) =>
|
createWorkspace = async (data: Partial<IWorkspace>) =>
|
||||||
await this.workspaceService.createWorkspace(data).then((response) => {
|
await this.workspaceService.createWorkspace(data).then((response) => {
|
||||||
this.dataStore.workspaceData.addWorkspaces([response]);
|
this.data.workspace.addWorkspaces([response]);
|
||||||
runInAction(() => {
|
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;
|
return response;
|
||||||
});
|
});
|
||||||
@ -68,7 +68,7 @@ export class UserModel implements IUserModel {
|
|||||||
await this.workspaceService.deleteWorkspace(workspaceSlug).then(() => {
|
await this.workspaceService.deleteWorkspace(workspaceSlug).then(() => {
|
||||||
const updatedWorkspacesList = this.workspaces;
|
const updatedWorkspacesList = this.workspaces;
|
||||||
const workspaceId = this.getWorkspaceBySlug(workspaceSlug)?.id;
|
const workspaceId = this.getWorkspaceBySlug(workspaceSlug)?.id;
|
||||||
this.dataStore.workspaceData.deleteWorkspace(`${workspaceId}`);
|
this.data.workspace.deleteWorkspace(`${workspaceId}`);
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
delete updatedWorkspacesList[`${workspaceId}`];
|
delete updatedWorkspacesList[`${workspaceId}`];
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user