Skip to content

Commit

Permalink
add new fix
Browse files Browse the repository at this point in the history
  • Loading branch information
o6ez9na committed Dec 8, 2024
1 parent caa2d88 commit 8943855
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions frontend/src/components/auth/register/RegisterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { Link, Routes, Route, useNavigate } from "react-router-dom";
import AuthForm from "../login/auth";
import "../login/components/auth-style.css";
import Instance from "../../api/instance";
import {useNotification} from "../../context/NotificationContext";
import { useNotification } from "../../context/NotificationContext";

export default function RegisterForm() {
const [login, setLogin] = useState("");
const [username, setUsername] = useState("");
const [phone, setPhone] = useState("");
const [passwordFirst, setPasswordFirst] = useState("");
const [passwordSecond, setPasswordSecond] = useState("");
const {addNotification} = useNotification();
const { addNotification } = useNotification();
const navigate = useNavigate();

const handleSubmit = async (e) => {
Expand All @@ -33,21 +33,19 @@ export default function RegisterForm() {
navigate("/login");
} catch (error) {
if (error.response && error.response.data) {
for (const err of Object.entries(error.response.data)) {
addNotification(`${err}`, "error");
for (const [key, value] of Object.entries(error.response.data)) {
addNotification(`${value}`, "error");
}
} else {
addNotification("An error occurred. Please try again.", "error");
}
}
};


const handleChange = (setter) => (event) => {
setter(event.target.value);
};


return (
<div className="intro">
<div className="auth-page-wrapper">
Expand Down

0 comments on commit 8943855

Please sign in to comment.