diff --git a/src/Routes.tsx b/src/Routes.tsx
index 394c6d61..96475392 100644
--- a/src/Routes.tsx
+++ b/src/Routes.tsx
@@ -70,6 +70,7 @@ const AuthedContainer = () => {
{/* Direct */}
+
{/* 404 페이지 필요*/}
>
);
diff --git a/src/app/store/ducks/auth/authSlice.ts b/src/app/store/ducks/auth/authSlice.ts
index 2e4b6a60..41071cb9 100644
--- a/src/app/store/ducks/auth/authSlice.ts
+++ b/src/app/store/ducks/auth/authSlice.ts
@@ -4,7 +4,6 @@ import {
getUserInfo,
signIn,
resetPassword,
- checkCurrentURL,
signInUseCode,
logout,
} from "./authThunk";
@@ -125,9 +124,6 @@ const authSlice = createSlice({
.addCase(resetPassword.rejected, (state) => {
state.errorMessage = `전에 사용한 적 없는 새로운 비밀번호를 만드세요.`;
})
- .addCase(checkCurrentURL.rejected, (state) => {
- // 유효하지 않은 url **
- })
.addCase(logout.fulfilled, (state) => {
state.isLogin = false;
});
diff --git a/src/app/store/ducks/auth/authThunk.ts b/src/app/store/ducks/auth/authThunk.ts
index 24368e4f..782c3d03 100644
--- a/src/app/store/ducks/auth/authThunk.ts
+++ b/src/app/store/ducks/auth/authThunk.ts
@@ -63,22 +63,14 @@ export const getUserInfo = createAsyncThunk(
export const checkCurrentURL = createAsyncThunk<
void,
{ code: string; username: string }
->("auth/checkResetPassword", async (payload, ThunkOptions) => {
- try {
- const config = {
- params: {
- code: payload.code,
- username: payload.username,
- },
- };
- const { data } = await customAxios.get(
- `/accounts/password/reset`,
- config,
- );
- console.log(data);
- } catch (error) {
- throw ThunkOptions.rejectWithValue(error);
- }
+>("auth/checkResetPassword", async (payload) => {
+ const config = {
+ params: {
+ code: payload.code,
+ username: payload.username,
+ },
+ };
+ await customAxios.get(`/accounts/password/reset`, config);
});
export const resetPassword = createAsyncThunk<
diff --git a/src/components/Auth/ResetPassword/ResetPasswordForm.tsx b/src/components/Auth/ResetPassword/ResetPasswordForm.tsx
index 83ac270c..130977f8 100644
--- a/src/components/Auth/ResetPassword/ResetPasswordForm.tsx
+++ b/src/components/Auth/ResetPassword/ResetPasswordForm.tsx
@@ -1,4 +1,4 @@
-import { useLocation } from "react-router-dom";
+import { useHistory, useLocation } from "react-router-dom";
import queryString from "query-string";
import HeaderBeforeLogin from "./HeaderBeforeLogin";
import ContentBox from "components/Common/ContentBox";
@@ -77,6 +77,7 @@ export default function ResetPasswordForm() {
search,
) as AuthType.resetPasswordQuery;
const dispatch = useAppDispatch();
+ const history = useHistory();
const { errorMessage } = useAppSelector((state) => state.auth);
const [newPasswordInputProps, newPasswordIsValid] = useInput(
@@ -92,7 +93,11 @@ export default function ResetPasswordForm() {
);
useEffect(() => {
- dispatch(checkCurrentURL({ code, username }));
+ dispatch(checkCurrentURL({ code, username }))
+ .unwrap()
+ .catch(() => {
+ history.push("/error");
+ });
}, []);
const resetPasswordClickHandler = (