fix: store level fixes (#2597)

This commit is contained in:
sriram veeraghanta 2023-11-01 19:22:10 +05:30 committed by GitHub
parent d46eb9c59a
commit 8c620c4f96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 233 additions and 185 deletions

View file

@ -41,6 +41,8 @@ export interface IProjectStore {
joinedProjects: IProject[];
favoriteProjects: IProject[];
currentProjectDetails: IProject | undefined;
// actions
setProjectId: (projectId: string) => void;
setSearchQuery: (query: string) => void;
@ -137,6 +139,8 @@ export class ProjectStore implements IProjectStore {
projectMembers: computed,
projectEstimates: computed,
currentProjectDetails: computed,
joinedProjects: computed,
favoriteProjects: computed,
@ -198,6 +202,11 @@ export class ProjectStore implements IProjectStore {
return this.projects?.[this.rootStore.workspace.workspaceSlug];
}
get currentProjectDetails() {
if (!this.projectId) return;
return this.project_details[this.projectId];
}
get joinedProjects() {
if (!this.rootStore.workspace.workspaceSlug) return [];
return this.projects?.[this.rootStore.workspace.workspaceSlug]?.filter((p) => p.is_member);