Skip to content

Commit

Permalink
feat: useAuthInfo에서 반환 타입을 명시하여 타입 추론
Browse files Browse the repository at this point in the history
  • Loading branch information
simeunseo committed Nov 28, 2024
1 parent 25b825f commit 26c1f09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions apps/web/src/hooks/useAuthInfo.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { useEffect } from 'react';

import useAuthStore from '@/stores/useAuthStore';
import useAuthStore, { AuthInfo } from '@/stores/useAuthStore';

import { useUserProfileOfMe } from './api/user';

const useAuthInfo = () => {
interface AuthInfoReturn {
isLoading: boolean;
isAuthenticated: boolean;
authInfo: AuthInfo | null;
}

const useAuthInfo = (): AuthInfoReturn => {
const { data: user, isError } = useUserProfileOfMe();
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
const authInfo = useAuthStore((state) => state.authInfo);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/stores/useAuthStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { Provider } from '@repo/types';

interface AuthInfo {
export interface AuthInfo {
nickname: string;
profileImageUrl: string;
provider: Provider;
Expand Down

0 comments on commit 26c1f09

Please sign in to comment.