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";
|
||||
|
||||
export class DataStore {
|
||||
workspaceData: IWorkspaceData;
|
||||
workspace: IWorkspaceData;
|
||||
|
||||
constructor() {
|
||||
this.workspaceData = new WorkspaceData(this);
|
||||
this.workspace = new WorkspaceData(this);
|
||||
}
|
||||
|
||||
resetOnSignout() {}
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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<string, IWorkspaceModel>;
|
||||
@ -13,15 +13,15 @@ export class UserModel implements IUserModel {
|
||||
workspaces: Record<string, IWorkspaceModel> = {};
|
||||
|
||||
// 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<IWorkspace>) =>
|
||||
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}`];
|
||||
});
|
Loading…
Reference in New Issue
Block a user