fix: members list endpoint authorization (#2571)

* fix: members list endpoint authorization

* chore: update user types
This commit is contained in:
Aaryan Khandelwal 2023-10-31 13:11:13 +05:30 committed by GitHub
parent 49fd4427c8
commit 705b33377c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 13 deletions

View File

@ -38,7 +38,7 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
: null
);
// fetching user project member information
const { data: projectMemberInfo } = useSWR(
useSWR(
workspaceSlug && projectId ? `PROJECT_MEMBERS_ME_${workspaceSlug}_${projectId}` : null,
workspaceSlug && projectId
? () => userStore.fetchUserProjectInfo(workspaceSlug.toString(), projectId.toString())
@ -53,10 +53,8 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
);
// fetching project members
useSWR(
workspaceSlug && projectId && projectMemberInfo && [20, 15].includes(projectMemberInfo.role)
? `PROJECT_MEMBERS_${workspaceSlug}_${projectId}`
: null,
workspaceSlug && projectId && projectMemberInfo && [20, 15].includes(projectMemberInfo.role)
workspaceSlug && projectId ? `PROJECT_MEMBERS_${workspaceSlug}_${projectId}` : null,
workspaceSlug && projectId
? () => projectStore.fetchProjectMembers(workspaceSlug.toString(), projectId.toString())
: null
);

View File

@ -22,7 +22,7 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
// fetching all workspaces
useSWR(`USER_WORKSPACES_LIST`, () => workspaceStore.fetchWorkspaces());
// fetching user workspace information
const { data: workspaceMemberInfo } = useSWR(
useSWR(
workspaceSlug ? `WORKSPACE_MEMBERS_ME_${workspaceSlug}` : null,
workspaceSlug ? () => userStore.fetchUserWorkspaceInfo(workspaceSlug.toString()) : null
);
@ -33,12 +33,8 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
);
// fetch workspace members
useSWR(
workspaceSlug && workspaceMemberInfo && [20, 15].includes(workspaceMemberInfo.role)
? `WORKSPACE_MEMBERS_${workspaceSlug}`
: null,
workspaceSlug && workspaceMemberInfo && [20, 15].includes(workspaceMemberInfo.role)
? () => workspaceStore.fetchWorkspaceMembers(workspaceSlug.toString())
: null
workspaceSlug ? `WORKSPACE_MEMBERS_${workspaceSlug}` : null,
workspaceSlug ? () => workspaceStore.fetchWorkspaceMembers(workspaceSlug.toString()) : null
);
// fetch workspace labels
useSWR(

View File

@ -64,7 +64,7 @@ export interface IUserLite {
}
export interface IUserMemberLite extends IUserLite {
email: string;
email?: string;
}
export interface IUserActivity {