mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 09:45:29 +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') {
|
||||
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 => {
|
||||
addLocale(locale, translationsObj);
|
||||
useLocale(locale);
|
||||
addLocale(locale, translationsObj)
|
||||
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)
|
||||
.then(res => setMarkdown(res.data))
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
console.error(`Please create the /public/content/${resource} file.`)
|
||||
setMarkdown(undefined)
|
||||
})
|
||||
.finally(() => setLoading(false))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user