mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
fix: handle error and console.log
This commit is contained in:
parent
46ac93df89
commit
0d8c57265e
@ -5,10 +5,10 @@ export const regionNames = new Intl.DisplayNames([locale], {type: 'region'})
|
|||||||
|
|
||||||
if (locale !== 'en') {
|
if (locale !== 'en') {
|
||||||
fetch(`/locales/${locale}.po.json`).then(response => {
|
fetch(`/locales/${locale}.po.json`).then(response => {
|
||||||
if (!response.ok) throw new Error(`Failed to load translations for locale ${locale}`);
|
if (!response.ok) throw new Error(`Failed to load translations for locale ${locale}`)
|
||||||
response.json().then(translationsObj => {
|
response.json().then(translationsObj => {
|
||||||
addLocale(locale, translationsObj);
|
addLocale(locale, translationsObj)
|
||||||
useLocale(locale);
|
useLocale(locale)
|
||||||
})
|
})
|
||||||
})
|
}).catch(() => console.error(`Unable to retrieve translation file ${locale}.po.json`))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export default function TextPage({resource}: { resource: string }) {
|
|||||||
axios.get('/content/' + resource)
|
axios.get('/content/' + resource)
|
||||||
.then(res => setMarkdown(res.data))
|
.then(res => setMarkdown(res.data))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err)
|
console.error(`Please create the /public/content/${resource} file.`)
|
||||||
setMarkdown(undefined)
|
setMarkdown(undefined)
|
||||||
})
|
})
|
||||||
.finally(() => setLoading(false))
|
.finally(() => setLoading(false))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user