mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
add event invalidation
This commit is contained in:
@ -1,9 +1,10 @@
|
|||||||
import {useMutation} from "react-query";
|
import {useMutation, useQueryClient} from "react-query";
|
||||||
import {useAuthContext} from "@/contexts/AuthContext";
|
import {useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||||
import {fetchiPhoneCalendarEvents} from "@/calendar-integration/apple-calendar-utils";
|
import {fetchiPhoneCalendarEvents} from "@/calendar-integration/apple-calendar-utils";
|
||||||
|
|
||||||
export const useFetchAndSaveAppleEvents = () => {
|
export const useFetchAndSaveAppleEvents = () => {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
const {profileData} = useAuthContext();
|
const {profileData} = useAuthContext();
|
||||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||||
|
|
||||||
@ -29,5 +30,8 @@ export const useFetchAndSaveAppleEvents = () => {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries(["events"])
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import {useMutation} from "react-query";
|
import {useMutation, useQueryClient} from "react-query";
|
||||||
import {fetchGoogleCalendarEvents} from "@/calendar-integration/google-calendar-utils";
|
import {fetchGoogleCalendarEvents} from "@/calendar-integration/google-calendar-utils";
|
||||||
import {useAuthContext} from "@/contexts/AuthContext";
|
import {useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||||
|
|
||||||
export const useFetchAndSaveGoogleEvents = () => {
|
export const useFetchAndSaveGoogleEvents = () => {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
const {profileData} = useAuthContext();
|
const {profileData} = useAuthContext();
|
||||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||||
|
|
||||||
@ -41,5 +42,8 @@ export const useFetchAndSaveGoogleEvents = () => {
|
|||||||
throw error; // Ensure errors are propagated to the mutation
|
throw error; // Ensure errors are propagated to the mutation
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries(["events"])
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import {useMutation} from "react-query";
|
import {useMutation, useQueryClient} from "react-query";
|
||||||
import {useAuthContext} from "@/contexts/AuthContext";
|
import {useAuthContext} from "@/contexts/AuthContext";
|
||||||
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||||
import {fetchMicrosoftCalendarEvents} from "@/calendar-integration/microsoft-calendar-utils";
|
import {fetchMicrosoftCalendarEvents} from "@/calendar-integration/microsoft-calendar-utils";
|
||||||
|
|
||||||
export const useFetchAndSaveOutlookEvents = () => {
|
export const useFetchAndSaveOutlookEvents = () => {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
const {profileData} = useAuthContext();
|
const {profileData} = useAuthContext();
|
||||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||||
|
|
||||||
@ -32,5 +33,8 @@ export const useFetchAndSaveOutlookEvents = () => {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries(["events"])
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user