Fix modules
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
const MainLayout = ({ children }) => {
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
import LoginPage from '@/app/auth/login/page';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
const MainLayout = ({ children }: { children: React.ReactNode }) => {
|
||||
const auth = useAuth();
|
||||
|
||||
if (!auth.isAuthenticated) {
|
||||
// This would be a redirect in a real Next.js app
|
||||
return <LoginPage />;
|
||||
}
|
||||
|
||||
@@ -13,7 +19,7 @@ const MainLayout = ({ children }) => {
|
||||
<h1 className="text-xl font-bold">Video Voter</h1>
|
||||
<div>
|
||||
{auth.user?.role === 'admin' && (
|
||||
<a href="#admin" className="text-gray-600 hover:text-gray-900 mr-4">Admin</a>
|
||||
<a href="/main/admin" className="text-gray-600 hover:text-gray-900 mr-4">Admin</a>
|
||||
)}
|
||||
<Button onClick={auth.logout}>Logout</Button>
|
||||
</div>
|
||||
@@ -24,4 +30,6 @@ const MainLayout = ({ children }) => {
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default MainLayout;
|
||||
Reference in New Issue
Block a user