fix: put/post 이후 리다이렉트 수정
This commit is contained in:
parent
087393e400
commit
490c6eb1d9
@ -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));
|
||||
};
|
||||
|
||||
|
@ -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} />;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user