From b14261f0584ebd2637b6ba4fb964faf0887b650a Mon Sep 17 00:00:00 2001 From: zlayine Date: Mon, 21 Aug 2023 14:51:43 +0300 Subject: [PATCH 1/2] fix notification --- resources/js/api/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/api/index.ts b/resources/js/api/index.ts index 7b20853..e41e2b6 100644 --- a/resources/js/api/index.ts +++ b/resources/js/api/index.ts @@ -45,11 +45,11 @@ export class ApiService { if (resp.status === 401) { useAppStore().clearLogin(); snackbar.error({ title: 'Unauthorized', text: 'Session expired, try to sign in again' }); - return { field: 'Error', message: 'Unauthorized' }; + throw { field: 'Error', message: 'Unauthorized' }; } if (resp.status >= 400 && resp.status < 600) { - return resp as unknown as Error; + throw resp as unknown as Error; } return resp.json(); From 65d91363256e755923215f40a01ca52e9792d17f Mon Sep 17 00:00:00 2001 From: zlayine Date: Mon, 21 Aug 2023 17:32:08 +0300 Subject: [PATCH 2/2] fix login issue --- resources/js/store/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/js/store/index.ts b/resources/js/store/index.ts index 8c72a31..0d28691 100644 --- a/resources/js/store/index.ts +++ b/resources/js/store/index.ts @@ -53,6 +53,9 @@ export const useAppStore = defineStore('app', { try { this.setConfig(); if (!this.config.url) return false; + if (!this.isMultiTenant && !this.config.authorization_token.length) { + return false; + } const urlConfig = await this.checkURL(this.config.url); this.config.network = urlConfig.network; @@ -73,12 +76,9 @@ export const useAppStore = defineStore('app', { if (this.hasFuelTanksPackage) this.addFuelTanksNavigation(); if (this.hasMarketplacePackage) this.addMarketplaceNavigation(); + this.loggedIn = true; if (this.isMultiTenant && this.loggedIn) await this.getUser(); - if (!this.isMultiTenant && this.config.url && this.config.authorization_token) { - this.loggedIn = true; - } - return await this.fetchCollectionIds(); } catch (error: any) { snackbar.error({ title: error });