mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 14:11:13 -05:00
Fix: Resolve "Cannot find name 'logger'" errors
This commit is contained in:
@@ -73,18 +73,7 @@ export function DataExportTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setStatistics(stats);
|
setStatistics(stats);
|
||||||
|
|
||||||
logger.info('User statistics loaded', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'load_statistics'
|
|
||||||
});
|
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Failed to load statistics', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'load_statistics',
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Load statistics',
|
action: 'Load statistics',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
@@ -112,12 +101,6 @@ export function DataExportTab() {
|
|||||||
.limit(10);
|
.limit(10);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
logger.error('Failed to load activity log', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'load_activity_log',
|
|
||||||
error: error.message,
|
|
||||||
errorCode: error.code
|
|
||||||
});
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,19 +128,7 @@ export function DataExportTab() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setRecentActivity(activityData);
|
setRecentActivity(activityData);
|
||||||
|
|
||||||
logger.info('Activity log loaded', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'load_activity_log',
|
|
||||||
count: activityData.length
|
|
||||||
});
|
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Error loading activity log', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'load_activity_log',
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Load activity log',
|
action: 'Load activity log',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
@@ -176,12 +147,6 @@ export function DataExportTab() {
|
|||||||
// Validate export options
|
// Validate export options
|
||||||
const validatedOptions = exportOptionsSchema.parse(exportOptions);
|
const validatedOptions = exportOptionsSchema.parse(exportOptions);
|
||||||
|
|
||||||
logger.info('Starting data export', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'export_data',
|
|
||||||
options: validatedOptions
|
|
||||||
});
|
|
||||||
|
|
||||||
// Call edge function for secure export
|
// Call edge function for secure export
|
||||||
const { data, error, requestId } = await invokeWithTracking<ExportRequestResult>(
|
const { data, error, requestId } = await invokeWithTracking<ExportRequestResult>(
|
||||||
'export-user-data',
|
'export-user-data',
|
||||||
@@ -190,11 +155,6 @@ export function DataExportTab() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
logger.error('Edge function invocation failed', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'export_data',
|
|
||||||
error: error.message
|
|
||||||
});
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,12 +163,6 @@ export function DataExportTab() {
|
|||||||
setRateLimited(true);
|
setRateLimited(true);
|
||||||
setNextAvailableAt(data.next_available_at || null);
|
setNextAvailableAt(data.next_available_at || null);
|
||||||
|
|
||||||
logger.warn('Export rate limited', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'export_data',
|
|
||||||
nextAvailableAt: data.next_available_at
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(
|
handleError(
|
||||||
new AppError(
|
new AppError(
|
||||||
'Rate limited',
|
'Rate limited',
|
||||||
@@ -236,12 +190,6 @@ export function DataExportTab() {
|
|||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
|
|
||||||
logger.info('Data export completed', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'export_data',
|
|
||||||
dataSize: JSON.stringify(data.data).length
|
|
||||||
});
|
|
||||||
|
|
||||||
handleSuccess(
|
handleSuccess(
|
||||||
'Data exported successfully',
|
'Data exported successfully',
|
||||||
'Your data has been downloaded as a JSON file.'
|
'Your data has been downloaded as a JSON file.'
|
||||||
@@ -250,12 +198,6 @@ export function DataExportTab() {
|
|||||||
// Refresh activity log to show the export action
|
// Refresh activity log to show the export action
|
||||||
await loadRecentActivity();
|
await loadRecentActivity();
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Data export failed', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'export_data',
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Export data',
|
action: 'Export data',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
|||||||
@@ -96,19 +96,7 @@ export function LocationTab() {
|
|||||||
.filter((park): park is ParkOption => park !== null);
|
.filter((park): park is ParkOption => park !== null);
|
||||||
|
|
||||||
setParks(validatedParks);
|
setParks(validatedParks);
|
||||||
|
|
||||||
logger.info('Parks list loaded', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'fetch_parks',
|
|
||||||
count: validatedParks.length
|
|
||||||
});
|
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Error fetching parks', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'fetch_parks',
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Load parks list',
|
action: 'Load parks list',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
@@ -127,12 +115,6 @@ export function LocationTab() {
|
|||||||
.maybeSingle();
|
.maybeSingle();
|
||||||
|
|
||||||
if (error && error.code !== 'PGRST116') {
|
if (error && error.code !== 'PGRST116') {
|
||||||
logger.error('Failed to fetch accessibility preferences', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'fetch_accessibility_preferences',
|
|
||||||
error: error.message,
|
|
||||||
errorCode: error.code
|
|
||||||
});
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,18 +122,7 @@ export function LocationTab() {
|
|||||||
const validated = accessibilityOptionsSchema.parse(data.accessibility_options);
|
const validated = accessibilityOptionsSchema.parse(data.accessibility_options);
|
||||||
setAccessibility(validated);
|
setAccessibility(validated);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('Accessibility preferences loaded', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'fetch_accessibility_preferences'
|
|
||||||
});
|
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Error fetching accessibility preferences', {
|
|
||||||
userId: user.id,
|
|
||||||
action: 'fetch_accessibility_preferences',
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Load accessibility preferences',
|
action: 'Load accessibility preferences',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
|||||||
@@ -106,22 +106,11 @@ export function NotificationsTab() {
|
|||||||
throw new Error(result.error || 'Failed to save notification preferences');
|
throw new Error(result.error || 'Failed to save notification preferences');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('Notification preferences saved', {
|
|
||||||
action: 'save_notification_preferences',
|
|
||||||
userId: user.id
|
|
||||||
});
|
|
||||||
|
|
||||||
handleSuccess(
|
handleSuccess(
|
||||||
'Notification preferences saved',
|
'Notification preferences saved',
|
||||||
'Your notification settings have been updated successfully.'
|
'Your notification settings have been updated successfully.'
|
||||||
);
|
);
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
logger.error('Error saving notification preferences', {
|
|
||||||
action: 'save_notification_preferences',
|
|
||||||
userId: user.id,
|
|
||||||
error: error instanceof Error ? error.message : String(error)
|
|
||||||
});
|
|
||||||
|
|
||||||
handleError(error, {
|
handleError(error, {
|
||||||
action: 'Save notification preferences',
|
action: 'Save notification preferences',
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
|||||||
Reference in New Issue
Block a user