13 lines
473 B
TypeScript
13 lines
473 B
TypeScript
export async function getTransactions({ query }: { query: string }) {
|
|
const res = await fetch(`http://localhost:3000/api/transactions/deposit?${query}`, {
|
|
cache: "no-store",
|
|
});
|
|
|
|
if (!res.ok) {
|
|
// You can parse the error message from the response if your API sends one
|
|
const errorData = await res.json().catch(() => ({ message: 'Unknown error' }));
|
|
throw new Error(errorData.message || `HTTP error! status: ${res.status}`);
|
|
}
|
|
|
|
return res.json();
|
|
} |