Commit cfb8ed9 1 parent 416056c commit cfb8ed9 Copy full SHA for cfb8ed9
File tree 3 files changed +20
-2
lines changed
3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,30 @@ export const UserMenuItems = ({
29
29
setMobileMenuOpen ?: React . Dispatch < React . SetStateAction < boolean > > ;
30
30
} ) => {
31
31
const router = useRouter ( ) ;
32
+
33
+ const supabase = useSupabaseClient ( ) ;
32
34
33
35
const handleMobileMenuClick = ( ) => {
34
36
if ( setMobileMenuOpen ) {
35
37
setMobileMenuOpen ( false ) ;
36
38
}
37
39
} ;
38
40
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
+
39
56
return (
40
57
< >
41
58
< ul
@@ -99,6 +116,7 @@ export const UserMenuItems = ({
99
116
</ li >
100
117
</ ul >
101
118
< button
119
+ onClick = { handleLogout }
102
120
className = { `flex items-center gap-3.5 py-4 text-sm font-medium duration-300 ease-in-out hover:text-yellow-500 ${
103
121
router . pathname === '/admin' ? 'px-6' : 'sm:px-6'
104
122
} `}
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ export function PublicLanding () {
179
179
</ p >
180
180
< div className = 'mt-10 flex items-center justify-center gap-x-6' >
181
181
< a
182
- href = '/'
182
+ href = '/login '
183
183
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'
184
184
>
185
185
Get Started < span aria-hidden = 'true' > β</ span >
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const Login = () => {
21
21
< div className = 'container' style = { { padding : '50px 0 100px 0' } } >
22
22
{ ! session ? (
23
23
// <div className='w-80%'><Auth supabaseClient={supabase} appearance={{ theme: ThemeSupa }} theme='dark' /></div>
24
- < div > < LoginPage /> </ div >
24
+ < Layout > < LoginPage /> </ Layout >
25
25
) : (
26
26
< Layout > Logged in</ Layout >
27
27
) }
You canβt perform that action at this time.
0 commit comments