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