updated living space add list updagte

This commit is contained in:
2025-11-29 12:31:05 +03:00
parent eaca36573e
commit d22fc017df
35 changed files with 858 additions and 126 deletions

View File

@@ -0,0 +1,21 @@
'use client'
import { useMutation } from '@tanstack/react-query'
const fetchGraphQlDeleteLivingSpace = async (uuid: string): Promise<boolean> => {
console.log('Fetching test data from local API');
try {
const res = await fetch(`/api/living-space/delete?uuid=${uuid}`, { method: 'GET', cache: 'no-store', credentials: "include" });
if (!res.ok) { const errorText = await res.text(); console.error('Test data API error:', errorText); throw new Error(`API error: ${res.status} ${res.statusText}`) }
const data = await res.json();
return data
} catch (error) { console.error('Error fetching test data:', error); throw error }
};
export function useDeleteLivingSpacesMutation() {
return useMutation({
mutationFn: ({ uuid }: { uuid: string }) => fetchGraphQlDeleteLivingSpace(uuid),
onSuccess: () => { console.log("Living space deleted successfully") },
onError: (error) => { console.error("Delete living space failed:", error) },
})
}