implemented
This commit is contained in:
parent
40ca82bb45
commit
409e0df9a6
16 changed files with 2451 additions and 4 deletions
|
|
@ -8,10 +8,11 @@ import { sharedStyles } from "./styles/shared";
|
|||
|
||||
export default function Home() {
|
||||
const [count, setCount] = useState<number | null>(null);
|
||||
const { user, isLoading, logout, hasPermission } = useAuth();
|
||||
const { user, isLoading, logout, hasPermission, hasRole } = useAuth();
|
||||
const router = useRouter();
|
||||
|
||||
const canViewCounter = hasPermission(Permission.VIEW_COUNTER);
|
||||
const isRegularUser = hasRole("regular");
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoading) {
|
||||
|
|
@ -68,6 +69,12 @@ export default function Home() {
|
|||
<span style={styles.navCurrent}>Counter</span>
|
||||
<span style={styles.navDivider}>•</span>
|
||||
<a href="/sum" style={styles.navLink}>Sum</a>
|
||||
{isRegularUser && (
|
||||
<>
|
||||
<span style={styles.navDivider}>•</span>
|
||||
<a href="/profile" style={styles.navLink}>My Profile</a>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div style={styles.userInfo}>
|
||||
<span style={styles.userEmail}>{user.email}</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue