feat: add extraction status update listener with toast notifications
Some checks failed
Frontend CI / lint (push) Failing after 25s
Frontend CI / build (push) Has been skipped

This commit is contained in:
JSC
2025-08-24 13:24:34 +02:00
parent 64226f76c1
commit b1eb5c4ab2

View File

@@ -103,6 +103,33 @@ export function SocketProvider({ children }: SocketProviderProps) {
userEvents.emit(USER_EVENTS.USER_CREDITS_CHANGED, data) userEvents.emit(USER_EVENTS.USER_CREDITS_CHANGED, data)
}) })
// Listen for extraction status updates
newSocket.on('extraction_status_update', data => {
const { extraction_id, status, title, error } = data
switch (status) {
case 'processing':
toast.loading(`Extracting: ${title}`, {
id: `extraction-${extraction_id}`,
duration: Infinity, // Keep it open until status changes
})
break
case 'completed':
toast.dismiss(`extraction-${extraction_id}`)
toast.success(`Extraction complete: ${title}`, {
duration: 4000,
})
break
case 'failed':
toast.dismiss(`extraction-${extraction_id}`)
toast.error(`Extraction failed: ${title}`, {
description: error,
duration: 6000,
})
break
}
})
return newSocket return newSocket
}, [user]) }, [user])