- added hotlists being displayed

- functionality to delete hotlist
This commit is contained in:
2025-11-19 13:55:21 +00:00
parent ea93053dd3
commit 0b3dcbb265
7 changed files with 126 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import { useEffect, useReducer, type ReactNode } from "react";
import { IntegrationsContext } from "../IntegrationsContext";
import { useCameraBlackboard } from "../../hooks/useCameraBlackboard";
import { initialState, reducer } from "../reducers/IntegrationsContextReducer";
import { useHotlistData } from "../../hooks/useHotListData";
type IntegrationsProviderType = {
children: ReactNode;
@@ -10,6 +11,7 @@ type IntegrationsProviderType = {
export const IntegrationsProvider = ({ children }: IntegrationsProviderType) => {
const [state, dispatch] = useReducer(reducer, initialState);
const { mutation } = useCameraBlackboard();
const { query } = useHotlistData();
useEffect(() => {
let isMounted = true;
@@ -50,6 +52,13 @@ export const IntegrationsProvider = ({ children }: IntegrationsProviderType) =>
};
}, []);
useEffect(() => {
const fetchHotlistData = async () => {
dispatch({ type: "SETHOTLISTS", payload: query?.data?.hotlists });
};
fetchHotlistData();
}, [query?.data]);
return (
<IntegrationsContext.Provider
value={{