fixes, deleteFamily function, household signup

This commit is contained in:
ivic00
2025-02-15 00:34:42 +01:00
parent a8957c7ac7
commit f649828d80
14 changed files with 2559 additions and 698 deletions

View File

@ -2,9 +2,11 @@ import { useAuthContext } from "@/contexts/AuthContext";
import { useMutation } from "@tanstack/react-query";
import functions from '@react-native-firebase/functions';
import { Alert } from 'react-native';
import { useSignOut } from './useSignOut';
export const useDeleteFamily = () => {
const { user } = useAuthContext();
const signOut = useSignOut();
return useMutation({
mutationKey: ["deleteFamily"],
@ -16,6 +18,11 @@ export const useDeleteFamily = () => {
try {
const deleteFamilyFunction = functions().httpsCallable('deleteFamily');
const result = await deleteFamilyFunction({ familyId });
if (result.data.success) {
await signOut.mutateAsync();
}
return result.data;
} catch (error: any) {
if (error.code === 'permission-denied') {