Skip to content

Commit

Permalink
Cleanup PR
Browse files Browse the repository at this point in the history
  • Loading branch information
binamkayastha committed Jul 28, 2024
1 parent 2ca87b8 commit 09f2a9b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
4 changes: 0 additions & 4 deletions nepalingo-web/src/components/Flashcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ const Flashcard: React.FC = () => {
handleNextWord();
}, [selectedLanguage]);

function getRandomWord<T>(arr: Array<T>) {
return arr[Math.floor(Math.random() * arr.length)];
}

function getNextIndex(wordArray: Array<string>) {
const newIndex = (index + 1) % wordArray.length;
return newIndex;
Expand Down
11 changes: 2 additions & 9 deletions nepalingo-web/src/hooks/useDictionary.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import useSWR from "swr";
import useNewari from "@/hooks/useNewari";

import { Language } from "./Langauge";
import { getNewariWord } from "@/lib/getNewariWord";
import { getTajpuriyaWord } from "@/lib/getTajpuriyaWord";

export type DictionaryProps = {
language: string;
// If word is not specified, a word will be chosen
word?: string;
word: string;
};

export type Meaning = {
Expand Down Expand Up @@ -47,11 +44,7 @@ async function getFetcherByLanguage(
case "Tajpuriya":
return await getTajpuriyaWord(word);
default:
return {
error: { message: "Sorry the language does not exist" },
data: undefined,
isLoading: false,
};
throw new Error(`Language ${language} not supported`);
}
}

Expand Down
4 changes: 0 additions & 4 deletions nepalingo-web/src/lib/getNewariWord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export async function getNewariWord(word: string): Promise<DictionaryResponse> {
import.meta.env.VITE_NEPALBHASA_API_URL + api_endpoint,
{},
).then((r) => r.json());
// errors
// const customError = data?.errors.length
// ? { status: true, response: data.errors, message: data.errors[0] }
// : error;

const response: DictionaryResponse = {
language: "newari",
Expand Down

0 comments on commit 09f2a9b

Please sign in to comment.