- added nped category options for alert popups
- minor fix on modal for 'DISABLED' MCC
This commit is contained in:
@@ -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={{
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user