39 lines
994 B
TypeScript
39 lines
994 B
TypeScript
// Base
|
|
import * as base from './_crud-base'
|
|
|
|
const path = '/api/v1/device-order'
|
|
const name = 'device-order'
|
|
|
|
export function create(data: any) {
|
|
console.log('service create', data)
|
|
return base.create(path, data, name)
|
|
}
|
|
|
|
export function getList(params: any = null) {
|
|
return base.getList(path, params, name)
|
|
}
|
|
|
|
export function getDetail(id: number | string, params?: any) {
|
|
return base.getDetail(path, id, name, params)
|
|
}
|
|
|
|
export function update(id: number | string, data: any) {
|
|
return base.update(path, id, data, name)
|
|
}
|
|
|
|
export function remove(id: number | string) {
|
|
return base.remove(path, id, name)
|
|
}
|
|
|
|
export async function submit(id: number) {
|
|
try {
|
|
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
|
|
const result: any = {}
|
|
result.success = resp.success
|
|
result.body = (resp.body as Record<string, any>) || {}
|
|
return result
|
|
} catch (error) {
|
|
console.error(`Error putting ${name}:`, error)
|
|
throw new Error(`Failed to put ${name}`)
|
|
}
|
|
} |