Skip to content

Commit

Permalink
fix: 로그인 실패시 로그인 페이지로 이동하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seokkkkkk committed Jul 18, 2024
1 parent 533cc33 commit f1420dd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/OauthCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const OauthCallback = () => {
const [error, setError] = useState(null);
const { setRefreshToken, setAccessToken } = useTokenStore();
const navigate = useNavigate();
const [retry, setRetry] = useState(0);

const getKakaoToken = useCallback(async (code) => {
try {
Expand Down Expand Up @@ -59,7 +58,7 @@ const OauthCallback = () => {
} catch (error) {
setIsError(true);
setError(error);
setRetry((prev) => prev + 1);
navigate("/login", { replace: true });
} finally {
setIsLoading(false);
}
Expand All @@ -72,9 +71,8 @@ const OauthCallback = () => {
]);

useEffect(() => {
if (retry > 0) navigate("/login", { replace: true });
fetchTokens();
}, [fetchTokens, retry, navigate]);
}, [fetchTokens]);

if (isLoading) return <div>Loading...</div>;
if (isError) return <div>Error: {error.message}</div>;
Expand Down

0 comments on commit f1420dd

Please sign in to comment.