From cc5f1c70a42fd84496a1dbf7aa73933b9d869f52 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 12 Oct 2023 11:41:02 +0200 Subject: [PATCH] www: use websocket status ended for redirecting --- www/app/transcripts/useWebSockets.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/www/app/transcripts/useWebSockets.ts b/www/app/transcripts/useWebSockets.ts index 75bf8edd..cb31c4bf 100644 --- a/www/app/transcripts/useWebSockets.ts +++ b/www/app/transcripts/useWebSockets.ts @@ -177,6 +177,16 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { case "FINAL_LONG_SUMMARY": if (message.data) { setFinalSummary(message.data); + } + break; + + case "FINAL_TITLE": + console.debug("FINAL_TITLE event:", message.data); + break; + + case "STATUS": + console.log("STATUS event:", message.data); + if (message.data.value === "ended") { const newUrl = "/transcripts/" + transcriptId; router.push(newUrl); console.debug( @@ -186,13 +196,6 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { newUrl, ); } - break; - - case "FINAL_TITLE": - console.debug("FINAL_TITLE event:", message.data); - break; - - case "STATUS": setStatus(message.data); break;