Skip to content

Commit

Permalink
make immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Jan 25, 2024
1 parent cd5fc96 commit 6ea6de7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/web/src/client/_components/hooks/useUser.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { fetcher } from '@/features/swr/fetcher';
import type { getUserResponseSchema } from '@read-stack/openapi';
import useSWR from 'swr';
import useImmutableSWR from 'swr/immutable';
import type { z } from 'zod';

type GetMeResponse = z.infer<typeof getUserResponseSchema>;

export const useUser = () => {
const { data, error } = useSWR<GetMeResponse>('/api/v1/users/me', fetcher);
const { data, error } = useImmutableSWR<GetMeResponse>(
'/api/v1/users/me',
fetcher,
{},
);

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

0 comments on commit 6ea6de7

Please sign in to comment.