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