From f19610c19f06e491e8843c4108bc38a74ae657d7 Mon Sep 17 00:00:00 2001 From: Adwait Gharpure Date: Thu, 30 Jan 2025 20:20:42 +0530 Subject: [PATCH] Return JSON in quotes API --- src/app/api/quotes/route.ts | 2 +- src/app/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/quotes/route.ts b/src/app/api/quotes/route.ts index 71e9947..2041d5a 100644 --- a/src/app/api/quotes/route.ts +++ b/src/app/api/quotes/route.ts @@ -5,7 +5,7 @@ export async function GET(req: NextRequest) { try { const amountOfMTM: BN[] = (global as any).quotesService.getMTMAmountsFor1USDC(); const latestMTMAmount = amountOfMTM[amountOfMTM.length - 1].toString(); - return NextResponse.json(latestMTMAmount); + return NextResponse.json({ latestMTMAmount }); } catch (error) { return NextResponse.json({ error: 'Failed to fetch quotes' }, { status: 500 }); } diff --git a/src/app/page.tsx b/src/app/page.tsx index 889f59e..2ed258a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -26,7 +26,7 @@ const Page: React.FC = (): React.ReactElement => { const data = await response.json(); // Convert the string back to BN - const price = new BN(data); + const price = new BN(data.latestMTMAmount); setPriceMTMFor1USDC(price); } catch (error) { console.error('Failed to fetch price:', error);