Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
madihamallick committed Dec 18, 2023
1 parent a86bd26 commit 3f94352
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions client/src/pages/Login/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import loginImage from "../../assets/login.svg";
import Swal from "sweetalert2";
Expand All @@ -10,6 +10,12 @@ const Login = () => {
password: "",
});

useEffect(() => {
if (sessionStorage.getItem("token")) {
navigate("/");
}
}, [navigate]);

const handleChange = (event) => {
setValues({ ...values, [event.target.name]: event.target.value });
};
Expand All @@ -36,7 +42,7 @@ const Login = () => {
icon: "success",
confirmButtonText: "OK",
}).then(() => {
navigate("/");
navigate("/setavatar");
});
} else {
res.json().then((error) => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Register/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Register = () => {
icon: "success",
confirmButtonText: "OK",
}).then(()=>{
navigate('/setavatar')
navigate('/login')
})
} else {
res.json().then((error) => {
Expand Down

0 comments on commit 3f94352

Please sign in to comment.