diff options
Diffstat (limited to 'src/api/index.ts')
| -rw-r--r-- | src/api/index.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/api/index.ts b/src/api/index.ts index 39f5b40..c55bb21 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -10,7 +10,7 @@ import { aiMove } from 'js-chess-engine'; const router = express.Router(); const chesshMovePath = (gameId: number) => - (process.env.CHESSH_MOVE_PATH as unknown as string).replace( + process.env.CHESSH_MOVE_PATH!.replace( ':gameId', gameId.toString(), ); @@ -18,9 +18,12 @@ const chesshMovePath = (gameId: number) => const sendNextMove = (gameId: number, move: string): Promise<BotMoveResponse> => axios .post(chesshMovePath(gameId), { - token: process.env.BOT_TOKEN as unknown as string, attempted_move: move.toLowerCase(), - } as BotMoveAttempt) + } as BotMoveAttempt, { + headers: { + "authorization": process.env.BOT_TOKEN! + } + }) .then((r): BotMoveResponse => { const body = r.data as BotMoveResponse; if (r.status === 200) { |
