fix: alert przy braku połączenia z serwerem

This commit is contained in:
2023-01-30 15:26:36 +01:00
parent b6230e3f8e
commit ef72c5f129
2 changed files with 136 additions and 132 deletions
+5 -1
View File
@@ -73,6 +73,11 @@ export default defineComponent({
this.loadData(); this.loadData();
this.$router.push('/'); this.$router.push('/');
} catch (e: any) { } catch (e: any) {
if (!e.response || e.response.status === undefined) {
this.store.alertMessage = 'Wystąpił błąd podczas łączenia z serwerem!';
return;
}
const response = e.response; const response = e.response;
const status: number = response.status; const status: number = response.status;
@@ -82,7 +87,6 @@ export default defineComponent({
} }
this.store.alertMessage = 'Wystąpił błąd podczas łączenia z serwerem!'; this.store.alertMessage = 'Wystąpił błąd podczas łączenia z serwerem!';
return;
} }
}, },
}, },