fix build error

This commit is contained in:
2021-10-19 16:46:29 +02:00
parent beeac8c01b
commit f09c23373e
3 changed files with 13 additions and 5 deletions

View File

@@ -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 }
})

View File

@@ -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 }
})

View File

@@ -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 }