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

49 lines
1.3 KiB
JavaScript

const URL = "/one-api/mockup/masterdata/";
export async function search(token, packet_id, query) {
try {
var resp = await axios.post(URL + 'packet/search_px', {
token:token,
packet_id: packet_id,
search: query
});
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 save(token, packet_id, packet_price, packet_original_price, json_px) {
try {
var resp = await axios.post(URL + 'packet/save_px', {
token:token,
packet_id: packet_id,
packet_price: packet_price,
packet_original_price: packet_original_price,
json_px: json_px
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}