updated build add update delete
This commit is contained in:
@@ -14,12 +14,12 @@ const fetchGraphQlUsersList = async (params: ListArguments): Promise<UsersListRe
|
||||
} catch (error) { console.error('Error fetching test data:', error); throw error }
|
||||
};
|
||||
|
||||
const fetchGraphQlDeleteUser = async (uuid: string): Promise<boolean> => {
|
||||
const fetchGraphQlDeleteUser = async (uuid: string, refetchTable: () => void): Promise<boolean> => {
|
||||
console.log('Fetching test data from local API');
|
||||
try {
|
||||
const res = await fetch(`/api/users/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();
|
||||
const data = await res.json(); refetchTable()
|
||||
return data
|
||||
} catch (error) { console.error('Error fetching test data:', error); throw error }
|
||||
};
|
||||
@@ -30,7 +30,7 @@ export function useGraphQlUsersList(params: ListArguments) {
|
||||
|
||||
export function useDeleteUserMutation() {
|
||||
return useMutation({
|
||||
mutationFn: ({ uuid }: { uuid: string }) => fetchGraphQlDeleteUser(uuid),
|
||||
mutationFn: ({ uuid, refetchTable }: { uuid: string, refetchTable: () => void }) => fetchGraphQlDeleteUser(uuid, refetchTable),
|
||||
onSuccess: () => { console.log("User deleted successfully") },
|
||||
onError: (error) => { console.error("Delete user failed:", error) },
|
||||
})
|
||||
|
||||
@@ -35,11 +35,6 @@ function getColumns(appendBuildID: (id: string) => void, removeBuildID: (id: str
|
||||
header: "Token",
|
||||
cell: ({ getValue }) => getValue(),
|
||||
},
|
||||
{
|
||||
accessorKey: "collectionToken",
|
||||
header: "Collection Token",
|
||||
cell: ({ getValue }) => getValue(),
|
||||
},
|
||||
{
|
||||
accessorKey: "info.govAddressCode",
|
||||
header: "Gov Address Code",
|
||||
|
||||
Reference in New Issue
Block a user