19 lines
451 B
TypeScript
19 lines
451 B
TypeScript
export async function getApproves({ query }: { query: string }) {
|
|
const res = await fetch(
|
|
`http://localhost:4000/api/dashboard/approve?${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();
|
|
}
|