From 5cd836fbe8a8c77dc6daa5229542ed0ca568efe9 Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:04:21 +0545 Subject: [PATCH] fix: redirect to loginPopup on Manage Organization click if user not signed in (#1322) --- src/frontend/src/api/OrganisationService.ts | 4 ++++ src/frontend/src/views/Organisation.tsx | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/api/OrganisationService.ts b/src/frontend/src/api/OrganisationService.ts index 5ebb841207..57f31c2676 100644 --- a/src/frontend/src/api/OrganisationService.ts +++ b/src/frontend/src/api/OrganisationService.ts @@ -4,6 +4,7 @@ import { GetOrganisationDataModel, OrganisationModal } from '@/models/organisati import { CommonActions } from '@/store/slices/CommonSlice'; import { OrganisationAction } from '@/store/slices/organisationSlice'; import { API } from '.'; +import { createLoginWindow } from '@/utilfunctions/login'; function appendObjectToFormData(formData, object) { for (const [key, value] of Object.entries(object)) { @@ -49,6 +50,9 @@ export const OrganisationDataService: Function = (url: string) => { dispatch(OrganisationAction.GetOrganisationsData(response)); } catch (error) { dispatch(OrganisationAction.GetOrganisationDataLoading(false)); + if (error.response.status === 401) { + createLoginWindow('/'); + } } }; await getOrganisationData(url); diff --git a/src/frontend/src/views/Organisation.tsx b/src/frontend/src/views/Organisation.tsx index fc596caa43..8f183dcf1f 100644 --- a/src/frontend/src/views/Organisation.tsx +++ b/src/frontend/src/views/Organisation.tsx @@ -15,7 +15,6 @@ const Organisation = () => { const { type } = windowDimention(); //get window dimension - console.log(import.meta.env, 'test'); const [searchKeyword, setSearchKeyword] = useState(''); const [activeTab, setActiveTab] = useState<0 | 1>(0);