fix navigate from reset page
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import styles from "./ResetComponent.module.css";
|
||||
import { useState, type ReactElement, type SubmitEvent } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { requestPasswordReset } from "../../../api/ResetAPI/Reset";
|
||||
|
||||
export function Reset():ReactElement {
|
||||
const navigate = useNavigate();
|
||||
const [email, setEmail] = useState("");
|
||||
const [errors, setErrors] = useState<{ email?: string;}>({});
|
||||
|
||||
@@ -21,7 +22,7 @@ export function Reset():ReactElement {
|
||||
if (next.email) return;
|
||||
try {
|
||||
await requestPasswordReset(email);
|
||||
window.location.href = "http://localhost:8000/docs";
|
||||
navigate("/");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setErrors({ email: "Ошибка, попробуйте позже" });
|
||||
|
||||
Reference in New Issue
Block a user