Files
FE_CPONE/test/vuex/one-md-ticket-dispenser/api/ticketdispenser.js
2026-04-27 10:13:31 +07:00

84 lines
2.0 KiB
JavaScript

// const URL = "/one-api/v1/masterdata/";
// const URL = "/one-api/one-bb/td-blood-request/";
// const URL = "/one-api/training/";
const URL = "/one-api/mockup/masterdata/one-md-ticket-dispenser/";
export async function add(prm) {
try {
var resp = await axios.post(URL + 'ticketbooth/save', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function lookupbyname(prm) {
// console.log(prm);
try {
var resp = await axios.post(URL + 'ticketbooth/search', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function xdelete(token,id) {
try {
var resp = await axios.post(URL + 'ticketbooth/delete',
{ id: id, token:token });
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
// edit
export async function edit(prm) {
try {
var resp = await axios.post(URL + 'ticketbooth/edit', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}