- added hotlists being displayed
- functionality to delete hotlist
This commit is contained in:
@@ -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={{
|
||||
|
||||
Reference in New Issue
Block a user