From 77f7283bdc39b6b701b9cb761f2720c38ab0ddb9 Mon Sep 17 00:00:00 2001 From: Zouheir Layine <58786497+zlayine@users.noreply.github.com> Date: Mon, 10 Jun 2024 07:17:02 +0300 Subject: [PATCH] [PLA-1783] fix internal beams query (#120) --- resources/js/components/beam/BeamsList.vue | 1 + resources/js/store/index.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/resources/js/components/beam/BeamsList.vue b/resources/js/components/beam/BeamsList.vue index 180b371..83e6964 100644 --- a/resources/js/components/beam/BeamsList.vue +++ b/resources/js/components/beam/BeamsList.vue @@ -317,6 +317,7 @@ const getSingleUseCode = async () => { const getBeamCodes = async () => { isLoading.value = true; + await appStore.fetchInternal(); try { const res = await BeamApi.getBeams({ ...formatData(searchInput.value ? { codes: [searchInput.value] } : {}), diff --git a/resources/js/store/index.ts b/resources/js/store/index.ts index f51a10f..8c61cfd 100644 --- a/resources/js/store/index.ts +++ b/resources/js/store/index.ts @@ -197,6 +197,16 @@ export const useAppStore = defineStore('app', { return true; }, + async fetchInternal() { + try { + const internalConfig = await ApiService.fetchInternalUrl(this.config.url!); + if (internalConfig) { + this.internal = true; + } + } catch { + this.internal = false; + } + }, async login(email: string, password: string, recaptcha?: string) { const res = await AuthApi.login(email, password, recaptcha); if (!res.data.Login) {