From f96a4133a82c17775fb2c03607a497cc623c0de7 Mon Sep 17 00:00:00 2001 From: Paul Cramer Date: Tue, 10 Dec 2024 15:46:22 -0800 Subject: [PATCH] formatting --- src/app/api/charges/route.ts | 10 +++++----- src/hooks/useCreateCharge.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/api/charges/route.ts b/src/app/api/charges/route.ts index 9b628cf..b36bac1 100644 --- a/src/app/api/charges/route.ts +++ b/src/app/api/charges/route.ts @@ -7,13 +7,13 @@ export async function POST(request: Request) { if (!COINBASE_COMMERCE_API_KEY) { return NextResponse.json( { error: 'Missing Coinbase Commerce API key' }, - { status: 500 } + { status: 500 }, ); } try { const chargeDetails: ChargeDetails = await request.json(); - + const res = await fetch(`${COMMERCE_API_URL}/charges`, { method: 'POST', body: JSON.stringify(chargeDetails), @@ -32,7 +32,7 @@ export async function POST(request: Request) { }); return NextResponse.json( { error: `HTTP error! status: ${res.status}` }, - { status: res.status } + { status: res.status }, ); } @@ -42,7 +42,7 @@ export async function POST(request: Request) { console.error('Error creating charge:', error); return NextResponse.json( { error: 'Failed to create charge' }, - { status: 500 } + { status: 500 }, ); } -} \ No newline at end of file +} diff --git a/src/hooks/useCreateCharge.ts b/src/hooks/useCreateCharge.ts index 82be5f6..457d49a 100644 --- a/src/hooks/useCreateCharge.ts +++ b/src/hooks/useCreateCharge.ts @@ -21,12 +21,12 @@ const useCreateCharge = () => { 'Content-Type': 'application/json', }, }); - + if (!res.ok) { const error = await res.json(); throw new Error(error.error || 'Failed to create charge'); } - + const { id } = await res.json(); return id; } catch (error) {