From 3748df9a58ff92b71980eda613d4ffe6aa8bda91 Mon Sep 17 00:00:00 2001 From: "Elizabeth (Lizzy) Hunt" Date: Mon, 20 Nov 2023 12:45:06 -0700 Subject: use authorization header --- src/api/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/api') 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 => 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) { -- cgit v1.3