fix build
This commit is contained in:
@@ -21,6 +21,6 @@ export class AuthClient extends ApiClient {
|
||||
}
|
||||
|
||||
async logout() {
|
||||
return this.post(AUTH_ROUTES.LOGOUT, undefined)
|
||||
return this.post(AUTH_ROUTES.LOGOUT, {} as never)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ export const CUSTOMER_ROUTES = {
|
||||
EXPORT: "/api/customers/export",
|
||||
IMPORT: "/api/customers/import",
|
||||
CUSTOMER_TYPES: "/api/customer-types",
|
||||
ADD_NOTE: "/api/customers/{id}/add-note",
|
||||
DELETE_NOTE: "/api/customers/{id}/delete-note",
|
||||
UPDATE_PERMISSIONS: "/api/customers/{id}/update-permissions",
|
||||
NOTES: "/api/customers/{id}/notes/{note_id}",
|
||||
} as const satisfies Record<string, ApiPath>
|
||||
|
||||
export class CustomersClient extends CrudClient<typeof CUSTOMER_ROUTES.INDEX, typeof CUSTOMER_ROUTES.BY_ID> {
|
||||
@@ -37,14 +35,10 @@ export class CustomersClient extends CrudClient<typeof CUSTOMER_ROUTES.INDEX, ty
|
||||
}
|
||||
|
||||
async addNote(id: string, payload: { note: string }) {
|
||||
return this.post(CUSTOMER_ROUTES.ADD_NOTE, payload as never, { params: { id } } as never)
|
||||
return this.post(CUSTOMER_ROUTES.NOTES, payload as never, { params: { id, note_id: "0" } } as never)
|
||||
}
|
||||
|
||||
async deleteNote(customerId: string, noteId: number) {
|
||||
return this.delete(CUSTOMER_ROUTES.DELETE_NOTE, { params: { id: customerId }, query: { note_id: noteId } } as never)
|
||||
}
|
||||
|
||||
async updatePermissions(id: string, payload: ApiRequestBody<typeof CUSTOMER_ROUTES.UPDATE_PERMISSIONS, "post">) {
|
||||
return this.post(CUSTOMER_ROUTES.UPDATE_PERMISSIONS, payload as never, { params: { id } } as never)
|
||||
return this.delete(CUSTOMER_ROUTES.NOTES, { params: { id: customerId, note_id: String(noteId) } } as never)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class InspectionsClient extends CrudClient<
|
||||
|
||||
async getById(id: string) {
|
||||
const res = await super.list({ query: { id } } as never)
|
||||
return {...res, data: res.data[0] }
|
||||
return {...res, data: res.data?.[0] }
|
||||
}
|
||||
|
||||
async changeStatus(payload: ApiRequestBody<typeof INSPECTION_ROUTES.CHANGE_STATUS, "post">) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CrudClient } from "../infra/crud-client"
|
||||
import type { ApiClientOptions } from "../infra/client"
|
||||
import type { ApiOperationResponse, ApiPath, ApiRequestBody, ApiResponse } from "../infra/types"
|
||||
import { ApiBaseResponse } from "src/contracts/types"
|
||||
import { ApiBaseResponse } from "../contracts/types"
|
||||
|
||||
export const JOB_CARD_ROUTES = {
|
||||
INDEX: "/api/job-cards",
|
||||
|
||||
Reference in New Issue
Block a user