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:
28
packages/admin/src/api/tax-exemptions.ts
Normal file
28
packages/admin/src/api/tax-exemptions.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { queryOptions } from '@tanstack/react-query'
|
||||
import { api } from '@/lib/api-client'
|
||||
import type { TaxExemption } from '@/types/account'
|
||||
|
||||
export const taxExemptionKeys = {
|
||||
all: (accountId: string) => ['accounts', accountId, 'tax-exemptions'] as const,
|
||||
}
|
||||
|
||||
export function taxExemptionListOptions(accountId: string) {
|
||||
return queryOptions({
|
||||
queryKey: taxExemptionKeys.all(accountId),
|
||||
queryFn: () => api.get<{ data: TaxExemption[] }>(`/v1/accounts/${accountId}/tax-exemptions`),
|
||||
})
|
||||
}
|
||||
|
||||
export const taxExemptionMutations = {
|
||||
create: (accountId: string, data: Record<string, unknown>) =>
|
||||
api.post<TaxExemption>(`/v1/accounts/${accountId}/tax-exemptions`, data),
|
||||
|
||||
update: (id: string, data: Record<string, unknown>) =>
|
||||
api.patch<TaxExemption>(`/v1/tax-exemptions/${id}`, data),
|
||||
|
||||
approve: (id: string) =>
|
||||
api.post<TaxExemption>(`/v1/tax-exemptions/${id}/approve`, {}),
|
||||
|
||||
revoke: (id: string, reason: string) =>
|
||||
api.post<TaxExemption>(`/v1/tax-exemptions/${id}/revoke`, { reason }),
|
||||
}
|
||||
Reference in New Issue
Block a user