aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz>2023-11-20 12:45:06 -0700
committerGitHub <noreply@github.com>2023-11-20 12:45:06 -0700
commit3748df9a58ff92b71980eda613d4ffe6aa8bda91 (patch)
tree8fee58de955448d3e5e63ee212f3db09e59e5e8c /src
parent0f5555b92915b175a685a24ade9276d170ae37f5 (diff)
downloadchessh-bot-3748df9a58ff92b71980eda613d4ffe6aa8bda91.tar.gz
chessh-bot-3748df9a58ff92b71980eda613d4ffe6aa8bda91.zip
use authorization header
Diffstat (limited to 'src')
-rw-r--r--src/api/index.ts9
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) {