deploy
This commit is contained in:
18
src/features/admin/hooks/useCreateOrganizationWallets.ts
Normal file
18
src/features/admin/hooks/useCreateOrganizationWallets.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { createOrganizationWallets } from '../api/adminApi'
|
||||
import { ORGANIZATIONS_QUERY_KEY } from './useOrganizations'
|
||||
import { ORGANIZATION_QUERY_KEY } from './useOrganization'
|
||||
import { WALLETS_QUERY_KEY } from './useOrganizationWallets'
|
||||
|
||||
export function useCreateOrganizationWallets() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (organizationId: string) => createOrganizationWallets(organizationId),
|
||||
onSuccess: (_result, organizationId) => {
|
||||
// `has_wallets` flips to true server-side — refresh list and detail view.
|
||||
queryClient.invalidateQueries({ queryKey: ORGANIZATIONS_QUERY_KEY })
|
||||
queryClient.invalidateQueries({ queryKey: ORGANIZATION_QUERY_KEY(organizationId) })
|
||||
queryClient.invalidateQueries({ queryKey: WALLETS_QUERY_KEY(organizationId) })
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user