Files
vidow/vidow-front/src/features/counter/counterAPI.ts
2022-10-20 21:46:33 +02:00

13 lines
308 B
TypeScript

export async function fetchCount(amount = 1): Promise<{ data: number }> {
const response = await fetch('/api/counter', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount }),
})
const result = await response.json()
return result
}