Skip to content

Commit cfb8ed9

Browse files
committed
πŸ₯ŽπŸ€ΎπŸΌβ€β™‚️ ↝ [ FCDB-24 ] Login modal integrated into workflow, signup later
1 parent 416056c commit cfb8ed9

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

β€Žcomponents/Section/Navbar.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,30 @@ export const UserMenuItems = ({
2929
setMobileMenuOpen?: React.Dispatch<React.SetStateAction<boolean>>;
3030
}) => {
3131
const router = useRouter();
32+
33+
const supabase = useSupabaseClient();
3234

3335
const handleMobileMenuClick = () => {
3436
if (setMobileMenuOpen) {
3537
setMobileMenuOpen(false);
3638
}
3739
};
3840

41+
const handleLogout = async () => {
42+
try {
43+
const { error } = await supabase.auth.signOut();
44+
if (error) {
45+
// Handle error
46+
console.error('Error signing out:', error.message);
47+
} else {
48+
// Redirect or perform other actions after successful sign out
49+
router.push('/'); // Example: Redirect to the home page
50+
}
51+
} catch (error) {
52+
console.error('Error signing out:', error.message);
53+
}
54+
};
55+
3956
return (
4057
<>
4158
<ul
@@ -99,6 +116,7 @@ export const UserMenuItems = ({
99116
</li>
100117
</ul>
101118
<button
119+
onClick={handleLogout}
102120
className={`flex items-center gap-3.5 py-4 text-sm font-medium duration-300 ease-in-out hover:text-yellow-500 ${
103121
router.pathname === '/admin' ? 'px-6' : 'sm:px-6'
104122
}`}

β€Žpages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function PublicLanding () {
179179
</p>
180180
<div className='mt-10 flex items-center justify-center gap-x-6'>
181181
<a
182-
href='/'
182+
href='/login'
183183
className='rounded-md px-3.5 py-2.5 text-sm font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 hover:ring-2 hover:ring-yellow-300 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:text-white'
184184
>
185185
Get Started <span aria-hidden='true'>β†’</span>

β€Žpages/login/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Login = () => {
2121
<div className='container' style={{ padding: '50px 0 100px 0' }}>
2222
{!session ? (
2323
// <div className='w-80%'><Auth supabaseClient={supabase} appearance={{ theme: ThemeSupa }} theme='dark' /></div>
24-
<div><LoginPage /></div>
24+
<Layout><LoginPage /></Layout>
2525
) : (
2626
<Layout>Logged in</Layout>
2727
)}

0 commit comments

Comments
Β (0)