Skip to content

Commit

Permalink
Merge pull request #478 from egovernments/DPG-2197
Browse files Browse the repository at this point in the history
SM-3889: TQM ADMIN SESSION FIX
  • Loading branch information
nabeelmd-eGov authored Feb 2, 2024
2 parents 84f5216 + 0c8c03e commit e77d3e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ const Create = () => {
setFormSession(sessionFormData)
},[sessionFormData])

useEffect(()=> {
return () => {
if(!location.pathname.includes("tqm")){
sessionStorage.removeItem("Digit.CREATE_ADHOC_TEST")
}
}
},[])

const onFormValueChange = (setValue, formData, formState, reset, setError, clearErrors, trigger, getValues) => {
const temp = JSON.parse(sessionStorage.getItem("Digit.CREATE_ADHOC_TEST"))
if(!temp && _.isEmpty(formData?.TestStandard)) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useMemo} from "react";
import React, {useEffect, useMemo} from "react";
import { useTranslation } from "react-i18next";
import { Header, InboxSearchComposer,Loader } from "@egovernments/digit-ui-react-components";
import { tqmSearchConfigPlantOperator } from "./configPlantOperator";
Expand All @@ -8,6 +8,7 @@ const TqmSearch = () => {
// Hook calling to enable scroll persistent
const scrollPosition = Digit.Hooks.useScrollPersistence();
const configModuleName = Digit.Utils.getConfigModuleName()
const isUlbAdminLoggedIn = Digit.Utils.tqm.isUlbAdminLoggedIn()
const tenant = Digit.ULBService.getStateId();
const { isLoading, data } = Digit.Hooks.useCustomMDMS(
tenant,
Expand Down Expand Up @@ -62,6 +63,13 @@ const TqmSearch = () => {
),[data]);

const tqmSearchSession = Digit.Hooks.useSessionStorage("TQM_SEARCH_SESSION", {})
useEffect(()=> {
return () => {
if(!location.pathname.includes("tqm") && isUlbAdminLoggedIn){
sessionStorage.removeItem("Digit.TQM_SEARCH_SESSION")
}
}
},[])
if (isLoading) return <Loader />
return (
<React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ const InboxSearchComposer = ({configs,scrollPosition,browserSession}) => {
return () => {
revalidate();
setEnable(false);
if(!location.pathname.includes("tqm") && Digit.Utils.tqm.isUlbAdminLoggedIn()){
sessionStorage.removeItem("Digit.TQM_INBOX_SESSION")
}
};
});

Expand Down

0 comments on commit e77d3e5

Please sign in to comment.