From ab45bf3667c7d9726f0466b57ecc2a806983a4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 5 May 2023 14:25:31 +0200 Subject: [PATCH] if capacitor only notification is used when backend is offline --- src/boot/init.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/boot/init.ts b/src/boot/init.ts index e3ed67e..ab3db62 100644 --- a/src/boot/init.ts +++ b/src/boot/init.ts @@ -21,8 +21,8 @@ async function loadBaseUrl() { console.warn('Could not load BaseURL', e); } } - -class BackendError extends Error {} +// eslint-disable-next-line +class BackendError extends Error { } /** * Loading backend information @@ -68,8 +68,18 @@ export default boot(async ({ app, router }) => { // Handle errors from loading the backend information if (error instanceof BackendError || isAxiosError(error)) { router.isReady().finally(() => { - 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' }); + 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') { // Handle plugin not found errors