forgot-password redirected to /check-email on success
This commit is contained in:
1 parent
6ac5f3ab10
commit
45f093a432
1 file changed
+5
-3
@@ -8,10 +8,13 @@ import LeftArrow from "../../assets/Images/arrow-left.png";
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { recoveryValidation } from "../../Validation/validation";
|
import { recoveryValidation } from "../../Validation/validation";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
||||||
|
|
||||||
const ForgotPassword = () => {
|
const ForgotPassword = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false); // Used to disable the button while loading so user doesn't submit multiple times
|
const [isLoading, setIsLoading] = useState(false); // Used to disable the button while loading so user doesn't submit multiple times
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
@@ -47,9 +50,8 @@ const ForgotPassword = () => {
|
|||||||
if (error !== undefined) {
|
if (error !== undefined) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
const res = await axios.post(`${BASE_URL}/auth/recovery/request`, form);
|
await axios.post(`${BASE_URL}/auth/recovery/request`, form);
|
||||||
// TODO properly display success
|
navigate("/check-email");
|
||||||
alert(JSON.stringify(res.data));
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//TODO display error (Toast?)
|
//TODO display error (Toast?)
|
||||||
alert(error);
|
alert(error);
|
||||||
|
|||||||
Reference in new issue
Block a user