NavBar now shows correct name on login, sign up redirect functional
This commit is contained in:
1 parent
e356515098
commit
bb27a9f49f
2 files changed
+16
-3
No files matched your search
@@ -16,7 +16,7 @@ import ChevronDown from "../../assets/Images/Icon-chevron-down.png";
|
|||||||
import { clearAuthState } from "../../Features/Auth/authSlice";
|
import { clearAuthState } from "../../Features/Auth/authSlice";
|
||||||
import { clearMonitorState } from "../../Features/Monitors/monitorsSlice";
|
import { clearMonitorState } from "../../Features/Monitors/monitorsSlice";
|
||||||
|
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const settings = ["Profile", "Team", "Invite Colleagues", "Logout"];
|
const settings = ["Profile", "Team", "Invite Colleagues", "Logout"];
|
||||||
@@ -37,6 +37,7 @@ function NavBar() {
|
|||||||
const [anchorElUser, setAnchorElUser] = useState(null);
|
const [anchorElUser, setAnchorElUser] = useState(null);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const authState = useSelector((state) => state.auth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles opening the user menu.
|
* Handles opening the user menu.
|
||||||
@@ -156,7 +157,9 @@ function NavBar() {
|
|||||||
className="icon-button-avatar"
|
className="icon-button-avatar"
|
||||||
style={{ width: "25px", height: "25px" }}
|
style={{ width: "25px", height: "25px" }}
|
||||||
/>
|
/>
|
||||||
<div className="icon-button-toggle-title">Jackie Dawn</div>
|
<div className="icon-button-toggle-title">
|
||||||
|
{authState.user.firstname} {authState.user.lastname}
|
||||||
|
</div>
|
||||||
<img
|
<img
|
||||||
className="icon-button-toggle-pic"
|
className="icon-button-toggle-pic"
|
||||||
src={ChevronDown}
|
src={ChevronDown}
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ const Login = () => {
|
|||||||
setForm(newForm);
|
setForm(newForm);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSignupClick = () => {
|
||||||
|
navigate("/register");
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="login-page">
|
<div className="login-page">
|
||||||
<BackgroundPattern></BackgroundPattern>
|
<BackgroundPattern></BackgroundPattern>
|
||||||
@@ -137,7 +140,14 @@ const Login = () => {
|
|||||||
<div className="login-form-v3-spacing" />
|
<div className="login-form-v3-spacing" />
|
||||||
<div className="new-account-option">
|
<div className="new-account-option">
|
||||||
Don’t have an account?
|
Don’t have an account?
|
||||||
<span className="new-account-option-span">Sign up</span>
|
<span
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/register");
|
||||||
|
}}
|
||||||
|
className="new-account-option-span"
|
||||||
|
>
|
||||||
|
Sign up
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user