mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 00:31:13 -05:00
Implement type safety and JSONB elimination
This commit is contained in:
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import type { User } from '@supabase/supabase-js';
|
||||
import type { ModerationItem } from '@/types/moderation';
|
||||
|
||||
@@ -176,11 +177,11 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Action ${action} completed for ${item.id}`);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('❌ Error performing action:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: error.message || `Failed to ${action} content`,
|
||||
description: getErrorMessage(error) || `Failed to ${action} content`,
|
||||
variant: 'destructive',
|
||||
});
|
||||
throw error;
|
||||
@@ -211,11 +212,11 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Submission ${item.id} deleted`);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('❌ Error deleting submission:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: 'Failed to delete submission',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
throw error;
|
||||
@@ -243,11 +244,11 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Submission ${item.id} reset to pending`);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('❌ Error resetting submission:', error);
|
||||
toast({
|
||||
title: 'Reset Failed',
|
||||
description: error.message,
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
@@ -294,11 +295,11 @@ export function useModerationActions(config: ModerationActionsConfig): Moderatio
|
||||
});
|
||||
|
||||
logger.log(`✅ Retried ${failedItems.length} failed items for ${item.id}`);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('❌ Error retrying items:', error);
|
||||
toast({
|
||||
title: 'Retry Failed',
|
||||
description: error.message || 'Failed to retry items',
|
||||
description: getErrorMessage(error) || 'Failed to retry items',
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user