plane/apps/app/hooks/use-issues.tsx
Aaryan Khandelwal 96ad751e11
style: new workspace dashboard design (#454)
* style: workspace dashboard

* feat: activity graph
2023-03-16 01:36:21 +05:30

23 lines
588 B
TypeScript

import useSWR from "swr";
// services
import userService from "services/user.service";
// types
import type { IIssue } from "types";
// fetch-keys
import { USER_ISSUE } from "constants/fetch-keys";
const useIssues = (workspaceSlug: string | undefined) => {
// API Fetching
const { data: myIssues, mutate: mutateMyIssues } = useSWR<IIssue[]>(
workspaceSlug ? USER_ISSUE(workspaceSlug as string) : null,
workspaceSlug ? () => userService.userIssues(workspaceSlug as string) : null
);
return {
myIssues: myIssues,
mutateMyIssues,
};
};
export default useIssues;