fix: put/post 이후 리다이렉트 수정

This commit is contained in:
정기영 2024-08-05 11:15:53 +09:00
parent 087393e400
commit 490c6eb1d9
2 changed files with 6 additions and 4 deletions

View File

@ -1,13 +1,15 @@
import { InfoEditForm } from '../../components/InfoEditForm';
import { useAuth } from '../../hooks/api/useAuth';
import { useNavigate } from 'react-router-dom';
export default function MyInfoChangePage() {
const navigate = useNavigate();
const { updateInfo } = useAuth();
const handleSubmit = async (e, username, useremail) => {
e.preventDefault();
await updateInfo(username, useremail)
.then((res) => console.log(res))
.then(() => navigate('/'))
.catch((err) => console.log(err));
};

View File

@ -1,12 +1,12 @@
import { PasswordChangeForm } from '../../components/PasswordChangeForm';
import { useAuth } from '../../hooks/api/useAuth';
import { useNavigate } from 'react-router-dom';
export default function PasswordChangePage() {
// TODO: 400
const navigate = useNavigate();
const { updatePassword } = useAuth();
const handleSubmit = async (currentPw, newPw, newPwCheck) => {
console.log(currentPw, newPw);
await updatePassword(currentPw, newPw, newPwCheck);
await updatePassword(currentPw, newPw, newPwCheck).then(() => navigate('/'));
};
return <PasswordChangeForm onSubmit={handleSubmit} />;
}