summaryrefslogtreecommitdiff
path: root/frontend/src/serverHelper.ts
diff options
context:
space:
mode:
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;
+};