Add accounts UI with list, create, edit, detail tabs for all sub-entities
Accounts list with paginated table, search, sort. Account detail page with tabs for members, payment methods, tax exemptions, and processor links. All sub-entities have create/edit dialogs and delete actions. Forms use shared Zod schemas via react-hook-form.
This commit is contained in:
25
packages/admin/src/api/processor-links.ts
Normal file
25
packages/admin/src/api/processor-links.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { queryOptions } from '@tanstack/react-query'
|
||||
import { api } from '@/lib/api-client'
|
||||
import type { ProcessorLink } from '@/types/account'
|
||||
|
||||
export const processorLinkKeys = {
|
||||
all: (accountId: string) => ['accounts', accountId, 'processor-links'] as const,
|
||||
}
|
||||
|
||||
export function processorLinkListOptions(accountId: string) {
|
||||
return queryOptions({
|
||||
queryKey: processorLinkKeys.all(accountId),
|
||||
queryFn: () => api.get<{ data: ProcessorLink[] }>(`/v1/accounts/${accountId}/processor-links`),
|
||||
})
|
||||
}
|
||||
|
||||
export const processorLinkMutations = {
|
||||
create: (accountId: string, data: Record<string, unknown>) =>
|
||||
api.post<ProcessorLink>(`/v1/accounts/${accountId}/processor-links`, data),
|
||||
|
||||
update: (id: string, data: Record<string, unknown>) =>
|
||||
api.patch<ProcessorLink>(`/v1/processor-links/${id}`, data),
|
||||
|
||||
delete: (id: string) =>
|
||||
api.del<ProcessorLink>(`/v1/processor-links/${id}`),
|
||||
}
|
||||
Reference in New Issue
Block a user