mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 15:17:17 +00:00
Invalidate events when updating profile
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {useMutation} from "react-query";
|
||||
import {useMutation, useQueryClient} from "react-query";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||
|
||||
export const useUpdateUserData = () => {
|
||||
const {user: currentUser, refreshProfileData} = useAuthContext();
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationKey: ["updateUserData"],
|
||||
@ -35,6 +36,9 @@ export const useUpdateUserData = () => {
|
||||
} else {
|
||||
console.warn("No user found: currentUser and customUser are both undefined.");
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("events")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user