Skip to content

Commit

Permalink
Merge pull request #11 from Qfeed-Dev/feature/#1
Browse files Browse the repository at this point in the history
[Fix] 배포환경에서만 로그인 이후 라우팅 문제 발생 해결
  • Loading branch information
hamo-o authored Aug 12, 2023
2 parents 1e35360 + 3ed4139 commit 2f92414
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/hooks/account/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const getAccessToken = async (code: string) => {

export const useAuth = () => {
const router = useRouter();
const { user, isLoading } = useUserQuery();
const [isActive, setIsActive] = useState<boolean | undefined>(undefined);

const kakaoMutation = useMutation(getAccessToken, {
Expand All @@ -30,12 +29,13 @@ export const useAuth = () => {
}
});

const { user, isLoading } = useUserQuery();
useEffect(() => {
if (!kakaoMutation.isLoading && !isLoading && user !== undefined) {
setIsActive(useIsActive(user));
isActive ? router.push("/") : router.push("/sign-up/default");
}
}, [kakaoMutation.isLoading, isLoading, user, isActive, router]);
}, [kakaoMutation.isLoading, isActive, router]);

return {
kakaoMutation
Expand Down
8 changes: 1 addition & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/**/*.tsx",
".next/types/**/*.ts"
],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}

0 comments on commit 2f92414

Please sign in to comment.