Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Refactor useProject function in use-project.ts

Kiran K9320f6e5a90e
diff --git a/apps/web/lib/swr/use-project.ts b/apps/web/lib/swr/use-project.ts
index ea37054f51..52f7f1b793 100644
--- a/apps/web/lib/swr/use-project.ts
+++ b/apps/web/lib/swr/use-project.ts
@@ -6,13 +6,15 @@ import useSWR from "swr";
export default function useProject() {
const { slug } = useParams() as { slug?: string };
- const {
- data: project,
- error,
- mutate,
- } = useSWR<ProjectProps>(slug && `/api/projects/${slug}`, fetcher, {
- dedupingInterval: 30000,
- });
+ const { data, error, mutate } = useSWR<{ data: ProjectProps }>(
+ slug && `/api/projects/${slug}`,
+ fetcher,
+ {
+ dedupingInterval: 30000,
+ },
+ );
+
+ const project = data?.data;
return {
...project,