fix: leave project mutation (#2976)

This commit is contained in:
Aaryan Khandelwal 2023-12-05 13:44:01 +05:30 committed by GitHub
parent 32bfa4d7cf
commit fd73f18d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -33,6 +33,7 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
const {
user: { currentUser, currentProjectMemberInfo, currentProjectRole, leaveProject },
projectMember: { removeMemberFromProject, updateMember },
project: { fetchProjects },
} = useMobxStore();
// hooks
const { setToastAlert } = useToast();
@ -46,7 +47,11 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
if (memberDetails.id === currentUser?.id) {
await leaveProject(workspaceSlug.toString(), projectId.toString())
.then(() => router.push(`/${workspaceSlug}/projects`))
.then(async () => {
await fetchProjects(workspaceSlug.toString());
router.push(`/${workspaceSlug}/projects`);
})
.catch((err) =>
setToastAlert({
type: "error",
@ -174,7 +179,7 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
onClick={() => setRemoveMemberModal(true)}
className="opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto"
>
<XCircle className="h-3.5 w-3.5 text-custom-text-400" strokeWidth={2} />
<XCircle className="h-3.5 w-3.5 text-red-500" strokeWidth={2} />
</button>
</Tooltip>
)}

View File

@ -284,7 +284,7 @@ export const ProjectSidebarListItem: React.FC<Props> = observer((props) => {
<CustomMenu.MenuItem onClick={handleLeaveProject}>
<div className="flex items-center justify-start gap-2">
<LogOut className="h-3.5 w-3.5 stroke-[1.5]" />
<span>Leave Project</span>
<span>Leave project</span>
</div>
</CustomMenu.MenuItem>
)}

View File

@ -243,7 +243,7 @@ export const WorkspaceMembersListItem: FC<Props> = observer((props) => {
: "opacity-0 pointer-events-none"
}
>
<XCircle className="h-3.5 w-3.5 text-custom-text-400" strokeWidth={2} />
<XCircle className="h-3.5 w-3.5 text-red-500" strokeWidth={2} />
</button>
</Tooltip>
</div>