mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
birthday through qr, deleteFam function
This commit is contained in:
@ -26,11 +26,13 @@ import { useDeleteUser } from "@/hooks/firebase/useDeleteUser";
|
||||
import { useUpdateHouseholdName } from "@/hooks/firebase/useUpdateHouseholdName";
|
||||
import { useGetHouseholdName } from "@/hooks/firebase/useGetHouseholdName";
|
||||
import { useGetFamilyMembers } from "@/hooks/firebase/useGetFamilyMembers";
|
||||
import { useDeleteFamily } from "@/hooks/firebase/useDeleteFamily";
|
||||
|
||||
const MyProfile = () => {
|
||||
const { user, profileData } = useAuthContext();
|
||||
const { data: familyMembers } = useGetFamilyMembers();
|
||||
const [takenColors, setTakenColors] = useState<string[]>([]);
|
||||
const { mutate: deleteFamily, isLoading } = useDeleteFamily();
|
||||
|
||||
const { data: hhName, refetch: refetchHHName } = useGetHouseholdName(
|
||||
profileData.familyId
|
||||
@ -181,6 +183,19 @@ const MyProfile = () => {
|
||||
debouncedUpdateUserData(color);
|
||||
};
|
||||
|
||||
const handleDeleteFamily = () => {
|
||||
if(profileData?.familyId){
|
||||
deleteFamily({familyId: profileData?.familyId}, {
|
||||
onSuccess: () => {
|
||||
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log("from delete fam:\n" + error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const debouncedUpdateUserData = useCallback(
|
||||
debounce(async (color: string) => {
|
||||
try {
|
||||
@ -568,7 +583,8 @@ const MyProfile = () => {
|
||||
onDismiss={handleHideDeleteDialog}
|
||||
onConfirm={() => {
|
||||
if(isDeleteFamily)
|
||||
console.log('put delete family func here');
|
||||
//deletes family
|
||||
handleDeleteFamily();
|
||||
else
|
||||
{
|
||||
//deletes profile
|
||||
|
||||
Reference in New Issue
Block a user