Skip to content

Commit

Permalink
fix: oauth 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seokkkkkk committed Jul 18, 2024
1 parent e01904b commit d57b95c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/OauthCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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 @@ -58,6 +59,7 @@ const OauthCallback = () => {
} catch (error) {
setIsError(true);
setError(error);
setRetry((prev) => prev + 1);
} finally {
setIsLoading(false);
}
Expand All @@ -70,8 +72,9 @@ const OauthCallback = () => {
]);

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

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

0 comments on commit d57b95c

Please sign in to comment.