forked from mito-systems/sol-mem-gen
Return JSON in quotes API
This commit is contained in:
parent
2f7fbac703
commit
f19610c19f
@ -5,7 +5,7 @@ export async function GET(req: NextRequest) {
|
|||||||
try {
|
try {
|
||||||
const amountOfMTM: BN[] = (global as any).quotesService.getMTMAmountsFor1USDC();
|
const amountOfMTM: BN[] = (global as any).quotesService.getMTMAmountsFor1USDC();
|
||||||
const latestMTMAmount = amountOfMTM[amountOfMTM.length - 1].toString();
|
const latestMTMAmount = amountOfMTM[amountOfMTM.length - 1].toString();
|
||||||
return NextResponse.json(latestMTMAmount);
|
return NextResponse.json({ latestMTMAmount });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return NextResponse.json({ error: 'Failed to fetch quotes' }, { status: 500 });
|
return NextResponse.json({ error: 'Failed to fetch quotes' }, { status: 500 });
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ const Page: React.FC = (): React.ReactElement => {
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// Convert the string back to BN
|
// Convert the string back to BN
|
||||||
const price = new BN(data);
|
const price = new BN(data.latestMTMAmount);
|
||||||
setPriceMTMFor1USDC(price);
|
setPriceMTMFor1USDC(price);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch price:', error);
|
console.error('Failed to fetch price:', error);
|
||||||
|
Loading…
Reference in New Issue
Block a user