|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
import { useState, useEffect } from 'react'; |
|
|
|
|
import { useSearchParams } from 'react-router-dom'; |
|
|
|
|
import { useNextGraphAuth } from '@/lib/nextgraph'; |
|
|
|
|
import { |
|
|
|
|
Typography, |
|
|
|
|
Box, |
|
|
|
@ -59,6 +60,7 @@ const TabPanel = ({ children, value, index }: TabPanelProps) => { |
|
|
|
|
const AccountPage = () => { |
|
|
|
|
const theme = useTheme(); |
|
|
|
|
const [searchParams] = useSearchParams(); |
|
|
|
|
const nextGraphAuth = useNextGraphAuth(); |
|
|
|
|
|
|
|
|
|
// Initialize tab from URL parameter
|
|
|
|
|
const initialTab = parseInt(searchParams.get('tab') || '0', 10); |
|
|
|
@ -599,9 +601,20 @@ const AccountPage = () => { |
|
|
|
|
<Button |
|
|
|
|
variant="outlined" |
|
|
|
|
startIcon={<Logout />} |
|
|
|
|
onClick={() => { |
|
|
|
|
// Handle logout
|
|
|
|
|
console.log('Logout clicked'); |
|
|
|
|
onClick={async () => { |
|
|
|
|
try { |
|
|
|
|
console.log('NextGraph Auth object:', nextGraphAuth); |
|
|
|
|
console.log('Available methods:', nextGraphAuth ? Object.keys(nextGraphAuth) : 'none'); |
|
|
|
|
|
|
|
|
|
if (nextGraphAuth?.logout && typeof nextGraphAuth.logout === 'function') { |
|
|
|
|
console.log('Calling logout...'); |
|
|
|
|
await nextGraphAuth.logout(); |
|
|
|
|
} else { |
|
|
|
|
console.log('Logout function not available or not a function'); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error('Logout failed:', error); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
sx={{
|
|
|
|
|
color: 'error.main', |
|
|
|
|