summaryrefslogtreecommitdiff
path: root/frontend/src/serverHelper.ts
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2025-06-10 23:50:09 -0700
committerKai Stevenson <kai@kaistevenson.com>2025-06-10 23:50:09 -0700
commit87f134c9f2714593890a530221df429122c4398b (patch)
tree1f3643751e6e213c514c4c24d3ae0242c584b2c3 /frontend/src/serverHelper.ts
init
Diffstat (limited to 'frontend/src/serverHelper.ts')
-rw-r--r--frontend/src/serverHelper.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/frontend/src/serverHelper.ts b/frontend/src/serverHelper.ts
new file mode 100644
index 0000000..8565fd6
--- /dev/null
+++ b/frontend/src/serverHelper.ts
@@ -0,0 +1,12 @@
+import axios from "axios";
+
+const SERVER_URL = "http://localhost:4000";
+
+export const getWords = async (): Promise<[...(string[] & { length: 9 })]> => {
+ const words = (await axios.get(`${SERVER_URL}/random-words`))
+ .data as string[];
+ if (words.length !== 16) {
+ throw new Error(`Got invalid words ${words} from server`);
+ }
+ return words;
+};