98 lines
2.5 KiB
JavaScript
98 lines
2.5 KiB
JavaScript
const URL = "/one-api/mockup/purchaserequestkacab/purchaserequestkacab/";
|
|
// https://accone.aplikasi.web.id/one-api/mockup/purchaserequestkacab/purchaserequestkacab/search
|
|
|
|
export async function search(payload) {
|
|
try {
|
|
var response = await axios.post(URL + "search", payload);
|
|
if (response.status !== 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: response.statusText,
|
|
};
|
|
}
|
|
|
|
let data = response.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message,
|
|
};
|
|
}
|
|
}
|
|
export async function getDetail(payload) {
|
|
try {
|
|
var response = await axios.post(URL + "getDetail", payload);
|
|
if (response.status !== 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: response.statusText,
|
|
};
|
|
}
|
|
|
|
let data = response.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message,
|
|
};
|
|
}
|
|
}
|
|
export async function approve(payload) {
|
|
try {
|
|
var response = await axios.post(URL + "approve", payload);
|
|
if (response.status !== 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: response.statusText,
|
|
};
|
|
}
|
|
|
|
let data = response.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message,
|
|
};
|
|
}
|
|
}
|
|
export async function updateqty(payload) {
|
|
try {
|
|
var response = await axios.post(URL + "updateqty", payload);
|
|
if (response.status !== 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: response.statusText,
|
|
};
|
|
}
|
|
|
|
let data = response.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message,
|
|
};
|
|
}
|
|
}
|
|
export async function approvelevel(params) {
|
|
try {
|
|
var response = await axios.post(URL + 'getUserApproveLevel', params);
|
|
if (response.status !== 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: response.statusText
|
|
};
|
|
}
|
|
|
|
let data = response.data
|
|
return data
|
|
} catch (error) {
|
|
return {
|
|
status: "ERR",
|
|
message: error.message
|
|
};
|
|
}
|
|
} |