- added nped category options for alert popups

- minor fix on modal for 'DISABLED' MCC
This commit is contained in:
2025-11-14 15:01:01 +00:00
parent 0a1ac97c57
commit dd1cd342c1
9 changed files with 184 additions and 45 deletions

View File

@@ -12,17 +12,39 @@ export const IntegrationsProvider = ({ children }: IntegrationsProviderType) =>
const { mutation } = useCameraBlackboard();
useEffect(() => {
const fetchData = async () => {
const result = await mutation.mutateAsync({
operation: "VIEW",
path: "sessionStats",
});
if (!result.result || typeof result.result === "string") return;
let isMounted = true;
dispatch({ type: "UPDATE", payload: result?.result });
const fetchData = async () => {
try {
const result = await mutation.mutateAsync({
operation: "VIEW",
path: "sessionStats",
});
if (!isMounted) return;
const catResult = await mutation.mutateAsync({
operation: "VIEW",
path: "CategoryPopup",
});
if (!isMounted) return;
if (!result?.result || typeof result.result === "string") return;
dispatch({ type: "UPDATE", payload: result.result });
dispatch({ type: "NPEDCATENABLED", payload: catResult.result });
} catch (error) {
console.error("Error in fetchData:", error);
}
};
fetchData();
return () => {
isMounted = false;
};
}, []);
return (
<IntegrationsContext.Provider
value={{

View File

@@ -6,6 +6,12 @@ export const initialState = {
sessionPaused: false,
savedSightings: [],
npedUser: null,
iscatEnabled: {
catA: true,
catB: true,
catC: true,
catD: false,
},
};
export function reducer(state: NPEDSTATE, action: NPEDACTION) {
@@ -40,6 +46,11 @@ export function reducer(state: NPEDSTATE, action: NPEDACTION) {
...state,
sessionList: action.payload,
};
case "NPEDCATENABLED":
return {
...state,
iscatEnabled: action.payload,
};
default:
return { ...state };
}