frontend fully integreated with the backend
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { api } from '@/lib/api'
|
||||
import type { PaginatedResponse, SupplierResponse } from '@/types/api'
|
||||
import type { PageParams } from './master'
|
||||
|
||||
export interface SupplierBody {
|
||||
name: string
|
||||
contactInfo?: string | null
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
export const suppliers = {
|
||||
list: (params?: PageParams) =>
|
||||
api.get<PaginatedResponse<SupplierResponse>>('/suppliers', { params }).then(r => r.data),
|
||||
|
||||
get: (id: string) =>
|
||||
api.get<SupplierResponse>(`/suppliers/${id}`).then(r => r.data),
|
||||
|
||||
create: (body: SupplierBody) =>
|
||||
api.post<SupplierResponse>('/suppliers', body).then(r => r.data),
|
||||
|
||||
update: (id: string, body: Partial<SupplierBody>) =>
|
||||
api.put<SupplierResponse>(`/suppliers/${id}`, body).then(r => r.data),
|
||||
}
|
||||
Reference in New Issue
Block a user