Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer committed Dec 10, 2024
1 parent 1293098 commit f96a413
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/app/api/charges/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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 },
);
}

Expand All @@ -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 },
);
}
}
}
4 changes: 2 additions & 2 deletions src/hooks/useCreateCharge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f96a413

Please sign in to comment.