Implement type safety and JSONB elimination

This commit is contained in:
gpt-engineer-app[bot]
2025-10-17 13:29:22 +00:00
parent efc33a7dda
commit d54b8a9ae4
10 changed files with 144 additions and 69 deletions

View File

@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
import { useToast } from '@/hooks/use-toast';
import { useUserRole } from '@/hooks/useUserRole';
import { useAuth } from '@/hooks/useAuth';
import { getErrorMessage } from '@/lib/errorHandler';
import {
fetchSubmissionItems,
buildDependencyTree,
@@ -99,10 +100,10 @@ export function SubmissionReviewManager({
.filter(item => item.status === 'pending')
.map(item => item.id);
setSelectedItemIds(new Set(pendingIds));
} catch (error: any) {
} catch (error) {
toast({
title: 'Error',
description: error.message || 'Failed to load submission items',
description: getErrorMessage(error),
variant: 'destructive',
});
} finally {
@@ -138,10 +139,10 @@ export function SubmissionReviewManager({
// No conflicts, proceed with approval
handleApprove();
}
} catch (error: any) {
} catch (error) {
toast({
title: 'Error',
description: error.message || 'Failed to check dependencies',
description: getErrorMessage(error),
variant: 'destructive',
});
} finally {
@@ -244,11 +245,11 @@ export function SubmissionReviewManager({
onComplete();
onOpenChange(false);
} catch (error: any) {
} catch (error) {
console.error('Error approving items:', error);
toast({
title: 'Error',
description: error.message || 'Failed to approve items',
description: getErrorMessage(error),
variant: 'destructive',
});
} finally {
@@ -299,11 +300,11 @@ export function SubmissionReviewManager({
onComplete();
onOpenChange(false);
} catch (error: any) {
} catch (error) {
console.error('Error rejecting items:', error);
toast({
title: 'Error',
description: 'Failed to reject items. Please try again.',
description: getErrorMessage(error),
variant: 'destructive',
});
} finally {
@@ -352,11 +353,11 @@ export function SubmissionReviewManager({
onComplete();
onOpenChange(false);
} 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',
});
} finally {
@@ -419,11 +420,11 @@ export function SubmissionReviewManager({
}
await loadSubmissionItems();
} catch (error: any) {
} catch (error) {
console.error('Error changing item status:', error);
toast({
title: 'Error',
description: error.message || 'Failed to change item status',
description: getErrorMessage(error),
variant: 'destructive',
});
} finally {