From 1e96bbe3b6de9a831675fadfe820509237daa76f Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 20 Feb 2024 18:41:12 +0100 Subject: [PATCH] Fixed double fetch --- frontend/src/Components/CountButton.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/Components/CountButton.tsx b/frontend/src/Components/CountButton.tsx index cce55af..a6f1b30 100644 --- a/frontend/src/Components/CountButton.tsx +++ b/frontend/src/Components/CountButton.tsx @@ -26,8 +26,7 @@ export function CountButton(): JSX.Element { // This is what runs on every button click function press(): void { async function pressPost(): Promise { - 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); }