mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 18:11:12 -05:00
Refactor: Update type safety status
This commit is contained in:
@@ -241,8 +241,8 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Action ${action} completed for ${item.id}`);
|
||||
} catch (error) {
|
||||
logger.error('❌ Error performing action:', error);
|
||||
} catch (error: unknown) {
|
||||
logger.error('❌ Error performing action:', { error: getErrorMessage(error) });
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: getErrorMessage(error) || `Failed to ${action} content`,
|
||||
@@ -276,8 +276,8 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Submission ${item.id} deleted`);
|
||||
} catch (error) {
|
||||
logger.error('❌ Error deleting submission:', error);
|
||||
} catch (error: unknown) {
|
||||
logger.error('❌ Error deleting submission:', { error: getErrorMessage(error) });
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: getErrorMessage(error),
|
||||
@@ -308,8 +308,8 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Submission ${item.id} reset to pending`);
|
||||
} catch (error) {
|
||||
logger.error('❌ Error resetting submission:', error);
|
||||
} catch (error: unknown) {
|
||||
logger.error('❌ Error resetting submission:', { error: getErrorMessage(error) });
|
||||
toast({
|
||||
title: 'Reset Failed',
|
||||
description: getErrorMessage(error),
|
||||
@@ -361,8 +361,8 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Retried ${failedItems.length} failed items for ${item.id}`);
|
||||
} catch (error) {
|
||||
logger.error('❌ Error retrying items:', error);
|
||||
} catch (error: unknown) {
|
||||
logger.error('❌ Error retrying items:', { error: getErrorMessage(error) });
|
||||
toast({
|
||||
title: 'Retry Failed',
|
||||
description: getErrorMessage(error) || 'Failed to retry items',
|
||||
|
||||
@@ -310,8 +310,8 @@ export function useRealtimeSubscriptions(
|
||||
);
|
||||
|
||||
onNewItem(fullItem);
|
||||
} catch (error) {
|
||||
logger.error('Error building new item notification:', error);
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error building new item notification:', { error: getErrorMessage(error) });
|
||||
}
|
||||
}, [
|
||||
filters,
|
||||
|
||||
@@ -61,7 +61,7 @@ function AuthProviderComponent({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[Auth] Session verification error:', error);
|
||||
return false;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ function AuthProviderComponent({ children }: { children: React.ReactNode }) {
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('Error updating Novu after email confirmation:', error);
|
||||
} finally {
|
||||
novuUpdateTimeoutRef.current = null;
|
||||
|
||||
@@ -107,7 +107,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
setCurrentVersion(versionsWithProfiles.find(v => v.is_current) || null);
|
||||
setLoading(false);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error fetching versions:', errorMsg);
|
||||
|
||||
@@ -139,7 +139,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
if (error) throw error;
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error comparing versions:', errorMsg);
|
||||
if (isMountedRef.current) {
|
||||
@@ -171,7 +171,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
await fetchVersions();
|
||||
}
|
||||
return data;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error rolling back version:', errorMsg);
|
||||
if (isMountedRef.current) {
|
||||
@@ -193,7 +193,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
if (channelRef.current) {
|
||||
try {
|
||||
supabase.removeChannel(channelRef.current);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error removing previous channel:', error);
|
||||
} finally {
|
||||
channelRef.current = null;
|
||||
|
||||
@@ -44,7 +44,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
const releaseInterval = setInterval(async () => {
|
||||
try {
|
||||
await supabase.rpc('release_expired_locks');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error auto-releasing expired locks:', error);
|
||||
}
|
||||
}, 120000); // 2 minutes
|
||||
@@ -82,7 +82,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
avgWaitHours: slaData.length > 0 ? totals.avgWaitHours / slaData.length : 0,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching queue stats:', error);
|
||||
}
|
||||
}, [user]);
|
||||
@@ -164,7 +164,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error extending lock:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
@@ -227,7 +227,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error releasing lock:', error);
|
||||
|
||||
// Always show error toasts even in silent mode
|
||||
@@ -273,7 +273,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
|
||||
fetchStats();
|
||||
return true;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error escalating submission:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
@@ -343,7 +343,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error claiming submission:', error);
|
||||
toast({
|
||||
title: 'Failed to Claim Submission',
|
||||
@@ -388,7 +388,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
|
||||
fetchStats();
|
||||
return true;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error reassigning submission:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
|
||||
@@ -105,7 +105,8 @@ export const useModerationStats = (options: UseModerationStatsOptions = {}) => {
|
||||
openReports: 0,
|
||||
flaggedContent: 0,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error fetching moderation stats:', error);
|
||||
} finally {
|
||||
// Only clear loading if it was set
|
||||
|
||||
@@ -62,7 +62,7 @@ export function usePhotoSubmissionItems(
|
||||
if (itemsError) throw itemsError;
|
||||
|
||||
setPhotos(data || []);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error fetching photo submission items:', errorMsg);
|
||||
setError(errorMsg);
|
||||
|
||||
@@ -71,13 +71,13 @@ export function useSearch(options: UseSearchOptions = {}) {
|
||||
logger.warn('Recent searches data is not an array, clearing');
|
||||
localStorage.removeItem('thrillwiki_recent_searches');
|
||||
}
|
||||
} catch (parseError) {
|
||||
} catch (parseError: unknown) {
|
||||
// JSON parse failed, data is corrupted
|
||||
console.error('Failed to parse recent searches from localStorage:', parseError);
|
||||
localStorage.removeItem('thrillwiki_recent_searches');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
// localStorage access failed
|
||||
console.error('Error accessing localStorage:', error);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ export function useSearch(options: UseSearchOptions = {}) {
|
||||
});
|
||||
|
||||
setResults(searchResults.slice(0, limit));
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Search error:', error);
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to search. Please try again.';
|
||||
setError(errorMessage);
|
||||
|
||||
@@ -55,7 +55,7 @@ export function useSessionMonitor() {
|
||||
window.location.href = '/auth';
|
||||
}, 30000);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Session monitor check failed', {
|
||||
userId: user.id,
|
||||
action: 'session_monitor',
|
||||
|
||||
@@ -69,7 +69,7 @@ export function useUnitPreferences() {
|
||||
await autoDetectPreferences();
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error loading unit preferences', {
|
||||
userId: user?.id,
|
||||
action: 'load_unit_preferences',
|
||||
@@ -115,7 +115,7 @@ export function useUnitPreferences() {
|
||||
|
||||
return newPreferences;
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error auto-detecting location', {
|
||||
userId: user?.id,
|
||||
action: 'auto_detect_location',
|
||||
@@ -149,7 +149,7 @@ export function useUnitPreferences() {
|
||||
} else {
|
||||
localStorage.setItem('unit_preferences', JSON.stringify(updated));
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error saving unit preferences', {
|
||||
userId: user?.id,
|
||||
action: 'save_unit_preferences',
|
||||
|
||||
@@ -51,7 +51,7 @@ export function useUserRole() {
|
||||
} else {
|
||||
setPermissions(permissionsData as unknown as UserPermissions);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching user roles:', error);
|
||||
setRoles([]);
|
||||
setPermissions(null);
|
||||
|
||||
@@ -37,7 +37,7 @@ export function useUsernameValidation(username: string, currentUsername?: string
|
||||
isChecking: false,
|
||||
error: isAvailable ? null : 'Username is already taken',
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
setState({
|
||||
isValid: false,
|
||||
isAvailable: null,
|
||||
|
||||
Reference in New Issue
Block a user