Fixed double fetch
This commit is contained in:
parent
3b51c69948
commit
1e96bbe3b6
1 changed files with 1 additions and 2 deletions
|
@ -26,8 +26,7 @@ export function CountButton(): JSX.Element {
|
|||
// This is what runs on every button click
|
||||
function press(): void {
|
||||
async function pressPost(): Promise<void> {
|
||||
await fetch(BUTTON_ENDPOINT, { method: "POST" });
|
||||
const response = await fetch(BUTTON_ENDPOINT);
|
||||
const response = await fetch(BUTTON_ENDPOINT, { method: "POST" });
|
||||
const data = (await response.json()) as CountResponse;
|
||||
setCount(data.pressCount);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue