Logout now calls the logout endpoint, role is now stored in local storage as well
This commit is contained in:
+11
-1
@@ -1,10 +1,20 @@
|
||||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
const Dashboard = () => {
|
||||
const [role, setRole] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
const role = localStorage.getItem("role");
|
||||
if (role) {
|
||||
setRole(role);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div style={{ color: "#fff", textAlign: "center", marginTop: "2rem" }}>
|
||||
<h1>Dashboard</h1>
|
||||
<p>Welcome! You are logged in.</p>
|
||||
{role === "SUPER" && <p style={{ fontWeight: "bold" }}>You are SUPER</p>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user