Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/Auth/LoginForm/FormAndButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import { useAppDispatch, useAppSelector } from "app/store/Hooks";
import { signIn } from "app/store/ducks/auth/authThunk";
import useInput from "hooks/useInput";
import Loading from "components/Common/Loading";
import { useHistory } from "react-router-dom";

const placeholder = {
username: "사용자 이름",
password: "비밀번호",
};

export default function LoginFormAndButton() {
const history = useHistory();

const [usernameInputProps, usernameIsValid, usernameIsFocus] = useInput(
"",
undefined,
Expand All @@ -36,7 +39,9 @@ export default function LoginFormAndButton() {
}),
);
};
requestSignIn();
requestSignIn().then(() => {
history.push("/");
});
};

return (
Expand Down
7 changes: 5 additions & 2 deletions src/components/Auth/ResetPassword/ResetPasswordForm.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -72,6 +72,7 @@ const Container = styled.section`
`;

export default function ResetPasswordForm() {
const history = useHistory();
const { search } = useLocation();
const { username, code } = queryString.parse(
search,
Expand Down Expand Up @@ -105,7 +106,9 @@ export default function ResetPasswordForm() {
username,
newPassword: newPasswordInputProps.value,
}),
);
).then(() => {
history.push("/");
});
};

return (
Expand Down
6 changes: 5 additions & 1 deletion src/components/Auth/SignUpForm/EmailConfirmForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { authAction } from "app/store/ducks/auth/authSlice";
import { signIn } from "app/store/ducks/auth/authThunk";
import { useState } from "react";
import Loading from "components/Common/Loading";
import { useHistory } from "react-router-dom";

const Container = styled.div`
.form-description {
Expand Down Expand Up @@ -71,6 +72,7 @@ const messageImage: CommonType.ImageProps = {
};

export default function EmailConfirmForm() {
const history = useHistory();
const userInput = useAppSelector((state) => state.auth.signUpUserData);
const dispatch = useAppDispatch();
const [errorMessage, setErrorMessage] = useState("");
Expand Down Expand Up @@ -129,7 +131,9 @@ export default function EmailConfirmForm() {
username: userInput.username,
password: userInput.password,
}),
);
).then(() => {
history.push("/");
});
} else if (status === 200 && !data) {
setErrorMessage(message);
// 인증코드가 다를 경우, 200번대가 아니라 400번대가 더 적합할 거 같음(사용자 입력에러니까)
Expand Down