fix invoice informations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { CrudClient } from "../infra/crud-client"
|
||||
import type { ApiClientOptions } from "../infra/client"
|
||||
import type { ApiPath } from "../infra/types"
|
||||
import type { ApiPath, ApiResponse } from "../infra/types"
|
||||
|
||||
export const ESTIMATE_ROUTES = {
|
||||
INDEX: "/api/estimates",
|
||||
@@ -25,8 +25,8 @@ export class EstimatesClient extends CrudClient<
|
||||
// Note: GET /api/estimates/{id} is not in the OpenAPI schema.
|
||||
// This method uses a type cast and relies on the backend supporting the route.
|
||||
async getById(id: string) {
|
||||
const data = await this.get(ESTIMATE_ROUTES.INDEX, { query: { id } } as never)
|
||||
return {...data, data: (data as any)?.data?.[0] ?? null }
|
||||
const data = await this.get(ESTIMATE_ROUTES.BY_ID, { params: { id } })
|
||||
return data;
|
||||
}
|
||||
|
||||
// ── Estimate Services ──
|
||||
@@ -48,7 +48,7 @@ export class EstimatesClient extends CrudClient<
|
||||
|
||||
// ── Estimate Parts ──
|
||||
async listParts(estimateId: string) {
|
||||
return this.get(ESTIMATE_ROUTES.PARTS, { params: { id: estimateId } } as never)
|
||||
return this.get(ESTIMATE_ROUTES.PARTS, { params: { id: estimateId } }) as Promise<ApiResponse<typeof ESTIMATE_ROUTES.PARTS, "get">>
|
||||
}
|
||||
|
||||
async addPart(estimateId: string, payload: { part_id?: number; quantity?: number; rate?: string; description?: string }) {
|
||||
|
||||
Reference in New Issue
Block a user