Skip to content

Commit

Permalink
succesfully made it cache data for all g-translate languages
Browse files Browse the repository at this point in the history
  • Loading branch information
NancyAanchal committed Aug 15, 2024
1 parent ec66a57 commit 9a928cd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions nepalingo-web/src/lib/getGTranslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const languageCodes: { [key: string]: string } = {

export const getGTranslate = async (
language: string,
word: string
word: string,
): Promise<{
language: string;
word: string;
Expand All @@ -37,7 +37,6 @@ export const getGTranslate = async (
console.error("Error fetching from cache:", error);
} else if (cachedResult) {
const translatedWord = cachedResult.translated_word;
console.log("used table");
return {
language,
word,
Expand All @@ -52,7 +51,6 @@ export const getGTranslate = async (
}

const url = `https://translation.googleapis.com/language/translate/v2?key=${GOOGLE_TRANSLATE_API_KEY}&q=${word}&target=${targetLanguage}`;
console.log("used api");
const response = await fetch(url);
const data = await response.json();

Expand Down

0 comments on commit 9a928cd

Please sign in to comment.