mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 07:11:13 -05:00
Fix settings validation and session errors
This commit is contained in:
@@ -146,19 +146,30 @@ export function SecurityTab() {
|
||||
const fetchSessions = async () => {
|
||||
if (!user) return;
|
||||
|
||||
const { data, error } = await supabase.rpc('get_my_sessions');
|
||||
setLoadingSessions(true);
|
||||
|
||||
if (error) {
|
||||
try {
|
||||
const { data, error } = await supabase.rpc('get_my_sessions');
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
setSessions((data as AuthSession[]) || []);
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch sessions', {
|
||||
userId: user.id,
|
||||
action: 'fetch_sessions',
|
||||
error: error.message
|
||||
error: error instanceof Error ? error.message : String(error)
|
||||
});
|
||||
handleError(error, { action: 'Load sessions', userId: user.id });
|
||||
} else {
|
||||
setSessions((data as AuthSession[]) || []);
|
||||
handleError(error, {
|
||||
action: 'Load active sessions',
|
||||
userId: user.id
|
||||
});
|
||||
setSessions([]);
|
||||
} finally {
|
||||
setLoadingSessions(false);
|
||||
}
|
||||
setLoadingSessions(false);
|
||||
};
|
||||
|
||||
const initiateSessionRevoke = async (sessionId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user