mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
12 lines
377 B
TypeScript
12 lines
377 B
TypeScript
// A mock function to mimic making an async request for data
|
|
export const fetchCount = async (amount = 1) => {
|
|
const response = await fetch("http://localhost:3000/api/counter", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ amount }),
|
|
});
|
|
const result: { data: number } = await response.json();
|
|
|
|
return result;
|
|
};
|