Files
2026-05-25 20:01:37 +07:00

177 lines
3.4 KiB
JavaScript

const URL =
"/one-api/mockup/masterdata/one-md-kelainan-lab-v2/kelainanlabv2/";
export async function search(prm) {
try {
var resp = await axios.post(URL + "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 searchtest(prm) {
try {
var resp = await axios.post(URL + "searchtest", 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 searchkelainan(token, prm) {
try {
var resp = await axios.post(URL + "searchkelainan", {
token: token,
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 add(prm) {
try {
var resp = await axios.post(URL + "add", 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 edit(prm) {
try {
var resp = await axios.post(URL + "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,
};
}
}
export async function deleterow(prm) {
try {
var resp = await axios.post(URL + "deleterow", 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 newData(prm) {
try {
var resp = await axios.post(URL + "newData", 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 editData(prm) {
try {
var resp = await axios.post(URL + "editData", 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 getfitness(prm) {
try {
var resp = await axios.post(URL + "getfitness", 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,
};
}
}