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

View File

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

View File

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