Skip to content

Commit

Permalink
chore: add token body to start
Browse files Browse the repository at this point in the history
  • Loading branch information
toanbku committed Jan 16, 2023
1 parent ff88dae commit 0de830c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/RightCorner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const RightCorner = () => {
if (window.confirm("Are you sure you want to start the game now?")) {
try {
setIsLoading(true);
await client.startGame(gameState?.id || "");
await client.startGame(gameState?.id || "", currentPlayer!.token);
mutateGameState();
} catch (error) {
alert(error);
Expand Down
5 changes: 4 additions & 1 deletion libs/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ class Client {
});
}

public startGame(id: string) {
public startGame(id: string, token: string) {
return fetcher<Response<Game>>(`${BASE_URL}/api/game/${id}/start`, {
method: "POST",
headers: {
...this.headers,
},
body: JSON.stringify({
token,
}),
});
}

Expand Down

0 comments on commit 0de830c

Please sign in to comment.