mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
26 lines
695 B
JavaScript
26 lines
695 B
JavaScript
'use client'; // Mark as a Client Component
|
|
import { useState } from 'react';
|
|
import { useSession } from 'next-auth/react';
|
|
|
|
export default function Admin() {
|
|
const { data: session } = useSession();
|
|
const [timerStarted, setTimerStarted] = useState(false);
|
|
|
|
if (session?.user?.role !== 'admin') {
|
|
return <p>Access denied</p>;
|
|
}
|
|
|
|
const startTimer = async () => {
|
|
// Implement timer logic (e.g., update database or state)
|
|
setTimerStarted(true);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<h1>Admin Console</h1>
|
|
<button onClick={startTimer} disabled={timerStarted}>
|
|
Start Timer
|
|
</button>
|
|
</div>
|
|
);
|
|
} |