19 lines
368 B
TypeScript
19 lines
368 B
TypeScript
|
import wretch from "wretch";
|
||
|
import { Cell } from "../types";
|
||
|
|
||
|
const USER_ID_HEADER = 'Player-id';
|
||
|
|
||
|
export const fetchGameState = async (
|
||
|
playerId: string,
|
||
|
gameId: number
|
||
|
): Promise<Cell[]> => {
|
||
|
const response = await wretch(`/game/${gameId}`)
|
||
|
.headers({
|
||
|
USER_ID_HEADER: playerId
|
||
|
})
|
||
|
.get()
|
||
|
.json();
|
||
|
console.log(response);
|
||
|
return [];
|
||
|
};
|