diff --git a/src/locales/en-EN.ts b/src/locales/en-EN.ts index 1e491dc..2dd8b23 100755 --- a/src/locales/en-EN.ts +++ b/src/locales/en-EN.ts @@ -1,4 +1,5 @@ import axios from "axios"; +import {Translation} from "~/types/types"; const translations = { header: { @@ -274,12 +275,12 @@ const translations = { export default async function () { let informations = {} - const response = await axios.get('https://athena.arthurdanjou.fr/translations', { + const response = await axios.get<{ translations: Translation[] }>('https://athena.arthurdanjou.fr/translations', { headers: { authorization: `Bearer ${process.env.API_TOKEN}` } }) - response.data.translations.map(({ code, english }: any) => { + response.data.translations.map(({ code, english }: Translation) => { informations = { ...informations, [code]: english } }) diff --git a/src/locales/fr-FR.ts b/src/locales/fr-FR.ts index 9358bcb..9bc3024 100755 --- a/src/locales/fr-FR.ts +++ b/src/locales/fr-FR.ts @@ -1,4 +1,5 @@ import axios from "axios"; +import {Translation} from "~/types/types"; const translations = { header: { @@ -274,12 +275,12 @@ const translations = { export default async function () { let informations = {} - const response = await axios.get('https://athena.arthurdanjou.fr/translations', { + const response = await axios.get<{ translations: Translation[] }>('https://athena.arthurdanjou.fr/translations', { headers: { authorization: `Bearer ${process.env.API_TOKEN}` } }) - response.data.translations.map(({ code, french }: any) => { + response.data.translations.map(({ code, french }: Translation) => { informations = { ...informations, [code]: french } }) diff --git a/types/types.ts b/types/types.ts index 6652b14..ac34fb4 100755 --- a/types/types.ts +++ b/types/types.ts @@ -5,6 +5,12 @@ interface Form { subject: string } +interface Translation { + code: string + french: string + english: string +} + interface Tag { slug: string } @@ -29,4 +35,4 @@ interface State { email: string } -export { Form, Post, Tag, NewsletterForm, State } +export { Form, Translation, Post, Tag, NewsletterForm, State }