Petropoulos Evangelos b110390253 add audits
2025-07-22 17:51:44 +03:00

26 lines
533 B
TypeScript

export async function getTransactions({
transactionType,
query,
}: {
transactionType: string;
query: string;
}) {
const res = await fetch(
`http://localhost:3000/api/dashboard/transactions/${transactionType}?${query}`,
{
cache: "no-store",
},
);
if (!res.ok) {
// Handle error from the API
const errorData = await res
.json()
.catch(() => ({ message: "Unknown error" }));
throw new Error(errorData.message || `HTTP error! status: ${res.status}`);
}
return res.json();
}