Inform user when server can't be reached on login
This commit is contained in:
parent
fbffda7da8
commit
578d210f77
@ -52,7 +52,9 @@ onMounted(async () => {
|
||||
/**
|
||||
* Fetch assets from the server
|
||||
*/
|
||||
assetStore.fetchAssets()
|
||||
if (!await assetStore.fetchAssets()) {
|
||||
notifications.addNotification({ message: 'Failed to fetch assets, the server may be offline or in maintenance. Please try again later.' })
|
||||
}
|
||||
})
|
||||
|
||||
async function loginFunc() {
|
||||
|
@ -21,15 +21,17 @@ export const useAssetStore = defineStore('assets', {
|
||||
setObjects(objects: Object[]) {
|
||||
this.objects = objects
|
||||
},
|
||||
fetchAssets() {
|
||||
fetch(config.server_endpoint + '/assets')
|
||||
async fetchAssets() {
|
||||
return fetch(config.server_endpoint + '/assets')
|
||||
.then((response) => response.json())
|
||||
.then((assets) => {
|
||||
this.setAssets(assets)
|
||||
this.setAssets(assets);
|
||||
return true;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error fetching assets:', error)
|
||||
})
|
||||
console.error('Error fetching assets:', error);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user