diff options
author | Kai Stevenson <kai@kaistevenson.com> | 2025-06-28 13:36:02 -0700 |
---|---|---|
committer | Kai Stevenson <kai@kaistevenson.com> | 2025-06-28 13:36:02 -0700 |
commit | 452ac1d2a9e238684605acc8820a4dd365e70cf8 (patch) | |
tree | 744d0d4fe08edc06ad8c0693f9444021d0aa00ea /frontend/src/serverHelper.ts | |
parent | 6475f534e7bf457113dcc82d94bfb7ac413f71c4 (diff) |
Diffstat (limited to 'frontend/src/serverHelper.ts')
-rw-r--r-- | frontend/src/serverHelper.ts | 16 |
1 files changed, 14 insertions, 2 deletions
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; +}; |