mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: 404 for my issues endpoint
since api endpoint was changed it was causing 404 for my issues, the new endpoint sends issues isolated to the workspace
This commit is contained in:
parent
8af3777afd
commit
b540c884c5
@ -15,7 +15,8 @@ export const MAGIC_LINK_SIGNIN = "/api/magic-sign-in/";
|
||||
export const USER_ENDPOINT = "/api/users/me/";
|
||||
export const CHANGE_PASSWORD = "/api/users/me/change-password/";
|
||||
export const USER_ONBOARD_ENDPOINT = "/api/users/me/onboard/";
|
||||
export const USER_ISSUES_ENDPOINT = "/api/users/me/issues/";
|
||||
export const USER_ISSUES_ENDPOINT = (workspaceSlug: string) =>
|
||||
`/api/workspaces/${workspaceSlug}/my-issues/`;
|
||||
export const USER_WORKSPACES = "/api/users/me/workspaces";
|
||||
|
||||
// s3 file url
|
||||
@ -33,8 +34,6 @@ export const JOIN_WORKSPACE = (workspaceSlug: string, invitationId: string) =>
|
||||
export const JOIN_PROJECT = (workspaceSlug: string) =>
|
||||
`/api/workspaces/${workspaceSlug}/projects/join/`;
|
||||
|
||||
export const USER_ISSUES = "/api/users/me/issues/";
|
||||
|
||||
// workspaces
|
||||
export const WORKSPACES_ENDPOINT = "/api/workspaces/";
|
||||
export const WORKSPACE_DETAIL = (workspaceSlug: string) => `/api/workspaces/${workspaceSlug}/`;
|
||||
|
@ -29,4 +29,4 @@ export const CYCLE_DETAIL = "CYCLE_DETAIL";
|
||||
export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId}`;
|
||||
export const STATE_DETAIL = "STATE_DETAIL";
|
||||
|
||||
export const USER_ISSUE = "USER_ISSUE";
|
||||
export const USER_ISSUE = (workspaceSlug: string) => `USER_ISSUE_${workspaceSlug}`;
|
||||
|
@ -16,8 +16,8 @@ class UserService extends APIService {
|
||||
};
|
||||
}
|
||||
|
||||
async userIssues(): Promise<any> {
|
||||
return this.get(USER_ISSUES_ENDPOINT)
|
||||
async userIssues(workspaceSlug: string): Promise<any> {
|
||||
return this.get(USER_ISSUES_ENDPOINT(workspaceSlug))
|
||||
.then((response) => {
|
||||
return response?.data;
|
||||
})
|
||||
|
@ -33,11 +33,11 @@ import { Menu, Transition } from "@headlessui/react";
|
||||
const MyIssues: NextPage = () => {
|
||||
const [selectedWorkspace, setSelectedWorkspace] = useState<string | null>(null);
|
||||
|
||||
const { user, workspaces } = useUser();
|
||||
const { user, workspaces, activeWorkspace } = useUser();
|
||||
|
||||
const { data: myIssues, mutate: mutateMyIssues } = useSWR<IIssue[]>(
|
||||
user ? USER_ISSUE : null,
|
||||
user ? () => userService.userIssues() : null
|
||||
user && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||
user && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||
);
|
||||
|
||||
const updateMyIssues = (
|
||||
|
@ -49,7 +49,7 @@ const Profile: NextPage = () => {
|
||||
const [isImageUploading, setIsImageUploading] = useState(false);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
|
||||
const { user: myProfile, mutateUser, projects } = useUser();
|
||||
const { user: myProfile, mutateUser, projects, activeWorkspace } = useUser();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
@ -86,8 +86,8 @@ const Profile: NextPage = () => {
|
||||
} = useForm<IUser>({ defaultValues });
|
||||
|
||||
const { data: myIssues } = useSWR<IIssue[]>(
|
||||
myProfile ? USER_ISSUE : null,
|
||||
myProfile ? () => userService.userIssues() : null
|
||||
myProfile && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||
myProfile && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||
);
|
||||
|
||||
const { data: invitations } = useSWR(USER_WORKSPACE_INVITATIONS, () =>
|
||||
@ -103,7 +103,7 @@ const Profile: NextPage = () => {
|
||||
icon: RectangleStackIcon,
|
||||
title: "My Issues",
|
||||
number: myIssues?.length ?? 0,
|
||||
description: "View the list of issues assigned to you across the workspace.",
|
||||
description: "View the list of issues assigned to you for this workspace.",
|
||||
href: "/me/my-issues",
|
||||
},
|
||||
{
|
||||
|
@ -26,8 +26,8 @@ const Workspace: NextPage = () => {
|
||||
const { user, activeWorkspace, projects } = useUser();
|
||||
|
||||
const { data: myIssues } = useSWR<IIssue[]>(
|
||||
user ? USER_ISSUE : null,
|
||||
user ? () => userService.userIssues() : null
|
||||
user && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||
user && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||
);
|
||||
|
||||
const cards = [
|
||||
|
Loading…
Reference in New Issue
Block a user