Logout now calls the logout endpoint, role is now stored in local storage as well

This commit is contained in:
hz
2025-05-13 10:58:45 -07:00
parent 643b525d1b
commit 6a1697048c
3 changed files with 35 additions and 3 deletions
+11 -1
View File
@@ -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>
);
};