68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
// API :
|
|
// search bank
|
|
// paramater : query , page , rowPerPage
|
|
const URL =
|
|
"/one-api/mockup/fo/registration/";
|
|
|
|
export async function search(noreg, search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'patient/search', {
|
|
search: search,
|
|
noreg: noreg
|
|
});
|
|
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_new(datas) {
|
|
try {
|
|
//sipe add token
|
|
datas["token"] = window.one_token();
|
|
var resp = await axios.post(URL + 'patient/add_new', datas);
|
|
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 search_idtype() {
|
|
try {
|
|
var resp = await axios.post(URL + 'patient/search_idtype', {});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch(e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|