mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 03:31:12 -05:00
Fix: Approve database migration
This commit is contained in:
@@ -9,6 +9,7 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { toast } from 'sonner';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { deleteTimelineEvent } from '@/lib/entitySubmissionHelpers';
|
||||
import type { EntityType, TimelineEvent } from '@/types/timeline';
|
||||
|
||||
@@ -113,10 +114,11 @@ export function EntityTimelineManager({
|
||||
toast.success('Event deleted', {
|
||||
description: 'Your timeline event has been deleted successfully.'
|
||||
});
|
||||
} catch (error: any) {
|
||||
console.error('Delete error:', error);
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Delete error:', errorMsg);
|
||||
toast.error('Failed to delete event', {
|
||||
description: error.message || 'Please try again.'
|
||||
description: errorMsg
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@ import { Loader2, Trash } from 'lucide-react';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { submitTimelineEvent, submitTimelineEventUpdate, deleteTimelineEvent } from '@/lib/entitySubmissionHelpers';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import type {
|
||||
EntityType,
|
||||
TimelineEventFormData,
|
||||
@@ -195,11 +196,12 @@ export function TimelineEventEditorDialog({
|
||||
onOpenChange(false);
|
||||
setShowDeleteConfirm(false);
|
||||
form.reset();
|
||||
} catch (error: any) {
|
||||
console.error('Delete error:', error);
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Delete error:', errorMsg);
|
||||
toast({
|
||||
title: 'Failed to delete event',
|
||||
description: error.message || 'Please try again.',
|
||||
description: errorMsg,
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user