mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 07:51:12 -05:00
Refactor: Complete type safety migration
This commit is contained in:
@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useAuth } from './useAuth';
|
||||
import { useToast } from './use-toast';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { getSubmissionTypeLabel } from '@/lib/moderation/entities';
|
||||
|
||||
interface QueuedSubmission {
|
||||
@@ -163,11 +164,11 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error extending lock:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: error.message || 'Failed to extend lock',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
@@ -226,13 +227,13 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error releasing lock:', error);
|
||||
|
||||
// Always show error toasts even in silent mode
|
||||
toast({
|
||||
title: 'Failed to Release Lock',
|
||||
description: error.message || 'An error occurred',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
@@ -272,11 +273,11 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
|
||||
fetchStats();
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error escalating submission:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: error.message || 'Failed to escalate submission',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
@@ -342,11 +343,11 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error claiming submission:', error);
|
||||
toast({
|
||||
title: 'Failed to Claim Submission',
|
||||
description: error.message || 'Could not claim this submission. Try again.',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
@@ -387,11 +388,11 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
|
||||
fetchStats();
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error('Error reassigning submission:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: error.message || 'Failed to reassign submission',
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user