Skip to content

Commit 6ea6de7

Browse files
committed
make immutable
1 parent cd5fc96 commit 6ea6de7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { fetcher } from '@/features/swr/fetcher';
22
import type { getUserResponseSchema } from '@read-stack/openapi';
3-
import useSWR from 'swr';
3+
import useImmutableSWR from 'swr/immutable';
44
import type { z } from 'zod';
55

66
type GetMeResponse = z.infer<typeof getUserResponseSchema>;
77

88
export const useUser = () => {
9-
const { data, error } = useSWR<GetMeResponse>('/api/v1/users/me', fetcher);
9+
const { data, error } = useImmutableSWR<GetMeResponse>(
10+
'/api/v1/users/me',
11+
fetcher,
12+
{},
13+
);
1014

1115
return { user: data?.user, error };
1216
};

0 commit comments

Comments
 (0)