From e492cca080c3035c0c51a6d53e6d4e7ca260996a Mon Sep 17 00:00:00 2001 From: sourabh-josh Date: Thu, 26 Sep 2024 10:55:04 +0530 Subject: [PATCH] fix: default light theme & microservice error handling --- app/src/app/api/transcribe/route.ts | 20 +++++--------------- app/src/app/layout.tsx | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/app/src/app/api/transcribe/route.ts b/app/src/app/api/transcribe/route.ts index f1d546d..2a20fc4 100644 --- a/app/src/app/api/transcribe/route.ts +++ b/app/src/app/api/transcribe/route.ts @@ -15,23 +15,13 @@ export async function POST(req: Request) { return new Response("Microservice URL not found", { status: 500 }); } - // const {data} = await axios.post(BASE_URL+'/upload-audio',{ - // audio_file_link: documentUrl, - // }) - - const response = await fetch(BASE_URL + "/upload-audio", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ + const {data,status:transcriptionStatus} = await axios.post(BASE_URL+'/upload-audio',{ audio_file_link: documentUrl, - }), - }); - - - const data = await response.json(); + }) + if(transcriptionStatus !== 200){ + return new Response("Internal server error", { status: 500 }); + } return new Response(JSON.stringify(data), { status: 200 }); } catch (error) { diff --git a/app/src/app/layout.tsx b/app/src/app/layout.tsx index b9781cb..be0dfe6 100644 --- a/app/src/app/layout.tsx +++ b/app/src/app/layout.tsx @@ -22,7 +22,7 @@ export default function RootLayout({