mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 15:17:17 +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 {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||
import {fetchiPhoneCalendarEvents} from "@/calendar-integration/apple-calendar-utils";
|
||||
|
||||
export const useFetchAndSaveAppleEvents = () => {
|
||||
const queryClient = useQueryClient()
|
||||
const {profileData} = useAuthContext();
|
||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||
|
||||
@ -29,5 +30,8 @@ export const useFetchAndSaveAppleEvents = () => {
|
||||
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 {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||
|
||||
export const useFetchAndSaveGoogleEvents = () => {
|
||||
const queryClient = useQueryClient()
|
||||
const {profileData} = useAuthContext();
|
||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||
|
||||
@ -41,5 +42,8 @@ export const useFetchAndSaveGoogleEvents = () => {
|
||||
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 {useCreateEventsFromProvider} from "@/hooks/firebase/useCreateEvent";
|
||||
import {fetchMicrosoftCalendarEvents} from "@/calendar-integration/microsoft-calendar-utils";
|
||||
|
||||
export const useFetchAndSaveOutlookEvents = () => {
|
||||
const queryClient = useQueryClient()
|
||||
const {profileData} = useAuthContext();
|
||||
const {mutateAsync: createEventsFromProvider} = useCreateEventsFromProvider();
|
||||
|
||||
@ -32,5 +33,8 @@ export const useFetchAndSaveOutlookEvents = () => {
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(["events"])
|
||||
},
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user