From 452ac1d2a9e238684605acc8820a4dd365e70cf8 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sat, 28 Jun 2025 13:36:02 -0700 Subject: MVP --- frontend/src/serverHelper.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'frontend/src/serverHelper.ts') diff --git a/frontend/src/serverHelper.ts b/frontend/src/serverHelper.ts index 8565fd6..3181093 100644 --- a/frontend/src/serverHelper.ts +++ b/frontend/src/serverHelper.ts @@ -1,12 +1,24 @@ import axios from "axios"; -const SERVER_URL = "http://localhost:4000"; +const SERVER_URL = ""; export const getWords = async (): Promise<[...(string[] & { length: 9 })]> => { - const words = (await axios.get(`${SERVER_URL}/random-words`)) + const words = (await axios.get(`${SERVER_URL}/api/random-words`)) .data as string[]; if (words.length !== 16) { throw new Error(`Got invalid words ${words} from server`); } return words; }; + +export const getCategory = async ( + words: string[] +): Promise<{ categoryName: string; reason: string }> => { + const response = ( + await axios.post(`${SERVER_URL}/api/group-words`, { + words, + }) + ).data; + + return response; +}; -- cgit v1.2.3-70-g09d2