Return JSON in quotes API

This commit is contained in:
Adwait Gharpure 2025-01-30 20:20:42 +05:30
parent 2f7fbac703
commit f19610c19f
2 changed files with 2 additions and 2 deletions

View File

@ -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 });
}

View File

@ -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);