Replace all team_id/team_admin references with account_id/owner across types, store, hooks, API clients, components, and pages. Add new AccountSettingsPage, UpgradePrompt, CheckoutButton, useSubscription hook, and accounts API client. AuthStore now parallel-fetches account and subscription data alongside user profile. Also fix folder sidebar not refreshing after tree deletion by dispatching the folder-changed event in handleDeleteTree. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import apiClient from './client'
|
|
import type { Category, CategoryListItem, CategoryCreate, CategoryUpdate } from '@/types'
|
|
|
|
export const categoriesApi = {
|
|
async list(includeInactive = false, accountOnly = false): Promise<CategoryListItem[]> {
|
|
const response = await apiClient.get<CategoryListItem[]>('/categories', {
|
|
params: { include_inactive: includeInactive, account_only: accountOnly },
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async get(id: string): Promise<Category> {
|
|
const response = await apiClient.get<Category>(`/categories/${id}`)
|
|
return response.data
|
|
},
|
|
|
|
async create(data: CategoryCreate): Promise<Category> {
|
|
const response = await apiClient.post<Category>('/categories', data)
|
|
return response.data
|
|
},
|
|
|
|
async update(id: string, data: CategoryUpdate): Promise<Category> {
|
|
const response = await apiClient.put<Category>(`/categories/${id}`, data)
|
|
return response.data
|
|
},
|
|
|
|
async delete(id: string): Promise<void> {
|
|
await apiClient.delete(`/categories/${id}`)
|
|
},
|
|
}
|
|
|
|
export default categoriesApi
|