forked from AkkomaGang/akkoma-fe
afterStoreSetup: Handle 404 cases.
This commit is contained in:
parent
446785ddce
commit
48ac96cfc7
1 changed files with 28 additions and 20 deletions
|
@ -7,6 +7,7 @@ import App from '../App.vue'
|
|||
const getStatusnetConfig = async ({ store }) => {
|
||||
try {
|
||||
const res = await window.fetch('/api/statusnet/config.json')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
const { name, closed: registrationClosed, textlimit, uploadlimit, server, vapidPublicKey } = data.site
|
||||
|
||||
|
@ -29,6 +30,9 @@ const getStatusnetConfig = async ({ store }) => {
|
|||
}
|
||||
|
||||
return data.site.pleromafe
|
||||
} else {
|
||||
throw (res)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Could not load statusnet config, potentially fatal')
|
||||
console.error(error)
|
||||
|
@ -38,7 +42,11 @@ const getStatusnetConfig = async ({ store }) => {
|
|||
const getStaticConfig = async () => {
|
||||
try {
|
||||
const res = await window.fetch('/static/config.json')
|
||||
if (res.ok) {
|
||||
return res.json()
|
||||
} else {
|
||||
throw (res)
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load static/config.json, continuing without it.')
|
||||
console.warn(error)
|
||||
|
|
Loading…
Reference in a new issue