if capacitor only notification is used when backend is offline

This commit is contained in:
Tim Gröger 2023-05-05 14:25:31 +02:00
parent 857d07040b
commit ab45bf3667
1 changed files with 14 additions and 4 deletions

View File

@ -21,8 +21,8 @@ async function loadBaseUrl() {
console.warn('Could not load BaseURL', e); console.warn('Could not load BaseURL', e);
} }
} }
// eslint-disable-next-line
class BackendError extends Error {} class BackendError extends Error { }
/** /**
* Loading backend information * Loading backend information
@ -68,8 +68,18 @@ export default boot(async ({ app, router }) => {
// Handle errors from loading the backend information // Handle errors from loading the backend information
if (error instanceof BackendError || isAxiosError(error)) { if (error instanceof BackendError || isAxiosError(error)) {
router.isReady().finally(() => { router.isReady().finally(() => {
if (Platform.is.capacitor) void router.push({ name: 'setup_backend' }); // if (Platform.is.capacitor) void router.push({ name: 'setup_backend' });
else void router.push({ name: 'offline', params: { refresh: 1 } }); if (Platform.is.capacitor) {
//void router.push({ name: 'setup_backend' })
Notify.create({
type: 'negative',
message:
'Backend nicht erreichbar! Prüfe deine Internetverbindung oder probiere es später nochmal.',
timeout: 0,
icon: 'mdi-alert-circle-outline',
closeBtn: true,
});
} else void router.push({ name: 'offline', params: { refresh: 1 } });
}); });
} else if (typeof error === 'string') { } else if (typeof error === 'string') {
// Handle plugin not found errors // Handle plugin not found errors