import axios from "axios"; const SERVER_URL = ""; export const getWords = async (): Promise<[...(string[] & { length: 9 })]> => { 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; };