reg modify
This commit is contained in:
parent
247c0b831f
commit
0b48eb739e
@ -38,6 +38,7 @@ const App = () => {
|
||||
useEffect(() => {
|
||||
async function verifyUser() {
|
||||
const response = await verifyUserApi(cookies.token);
|
||||
console.log("app", user)
|
||||
|
||||
if (response) {
|
||||
if (response.status === 200) {
|
||||
|
@ -4,24 +4,9 @@ import classes from "../assets/styles/components/navbar.module.scss";
|
||||
import { verifyUserApi } from "../hooks/api/enterAccountApi";
|
||||
|
||||
const NavBar = ({navigate, auth, setAuth}) => {
|
||||
// const [cookies, _, __] = useCookies(["user"]);
|
||||
|
||||
// useEffect(() => {
|
||||
// async function verifyUser() {
|
||||
// const response = await verifyUserApi(cookies.token);
|
||||
|
||||
// if (response) {
|
||||
// if (response.status === 200) {
|
||||
// setAuth(response.data);
|
||||
// }
|
||||
// else {
|
||||
// console.log(response)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// verifyUser()
|
||||
// }, []);
|
||||
useEffect(() => {
|
||||
console.log("nav", auth)
|
||||
})
|
||||
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
|
@ -17,7 +17,7 @@ const totalRegisterValidate = (data) => {
|
||||
// constructorAnswerValidate(data.email.length, "Обязательное поле."),
|
||||
// constructorAnswerValidate(data.phone.length, "Обязательное поле."),
|
||||
constructorAnswerValidate(data.password === data.repiedPassword, "Введенные пароли не совпадают."),
|
||||
constructorAnswerValidate(data.password >= 8, "Пароль должен иметь более 8 символов.")
|
||||
// constructorAnswerValidate(data.password >= 8, "Пароль должен иметь более 8 символов.")
|
||||
]
|
||||
|
||||
for (let value of listValidation) {
|
||||
|
@ -45,18 +45,11 @@ const EnterAccount = () => {
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
setUser({
|
||||
email: email,
|
||||
phone: phone,
|
||||
login: login,
|
||||
surname: surname,
|
||||
patronymic: patronymic,
|
||||
password: password,
|
||||
});
|
||||
const responseMe = await verifyUserApi(response.data.token)
|
||||
setUser(responseMe.data);
|
||||
setCookie("token", response.data.token);
|
||||
cleanState();
|
||||
window.location.reload();
|
||||
// navigate("/");
|
||||
navigate("/");
|
||||
}
|
||||
else {
|
||||
console.log("Error")
|
||||
@ -68,13 +61,11 @@ const EnterAccount = () => {
|
||||
|
||||
if (response.status === 200) {
|
||||
setCookie("token", response.data.token);
|
||||
const responseMe = await verifyUserApi(response.data.token)
|
||||
setUser(responseMe.data)
|
||||
|
||||
cleanState();
|
||||
// setUser({
|
||||
// login: login
|
||||
// })
|
||||
window.location.reload();
|
||||
// navigate("/")
|
||||
// window.location.reload()
|
||||
navigate("/")
|
||||
}
|
||||
else {
|
||||
console.log(response)
|
||||
|
Loading…
Reference in New Issue
Block a user