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

132 lines
3.3 KiB
JavaScript

const URL = "/one-api/mockup/masterdata/";
export async function lookup(token, search,langid, current_page ) {
try {
var resp = await axios.post(URL + 'testlangv2/lookup', { token: token, search: search, langid:langid, current_page:current_page });
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(prm) {
try {
var resp = await axios.post(URL + 'testlangv2/addnewmapword', 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 savenattestlang(prm) {
try {
var resp = await axios.post(URL + 'testlangv2/savenattestlang', 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 getlang(token) {
try {
var resp = await axios.post(URL + 'testlangv2/getlang',{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
};
}
}
export async function update(prm) {
try {
var resp = await axios.post(URL + 'testlangv2/editmapword', 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 updateunit(prm) {
try {
var resp = await axios.post(URL + 'testlangv2/updateunit', 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 + 'testlangv2/deletemapword', { 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
};
}
}