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
|
// This is what runs on every button click
|
||||||
function press(): void {
|
function press(): void {
|
||||||
async function pressPost(): Promise<void> {
|
async function pressPost(): Promise<void> {
|
||||||
await fetch(BUTTON_ENDPOINT, { method: "POST" });
|
const response = await fetch(BUTTON_ENDPOINT, { method: "POST" });
|
||||||
const response = await fetch(BUTTON_ENDPOINT);
|
|
||||||
const data = (await response.json()) as CountResponse;
|
const data = (await response.json()) as CountResponse;
|
||||||
setCount(data.pressCount);
|
setCount(data.pressCount);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue