mirror of
https://github.com/sergeyyarkov/modbus-logger.git
synced 2026-10-11 10:28:51 +03:00
26 lines
584 B
JavaScript
26 lines
584 B
JavaScript
const urlPrefix = "/api";
|
|
|
|
export default {
|
|
async patch(path, data) {
|
|
const response = await fetch(`${urlPrefix}${path}`, {
|
|
method: "PATCH",
|
|
body: new URLSearchParams(data),
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
},
|
|
});
|
|
return response;
|
|
},
|
|
|
|
async post(path, data) {
|
|
const response = await fetch(`${urlPrefix}${path}`, {
|
|
method: "POST",
|
|
body: new URLSearchParams(data),
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
},
|
|
});
|
|
return response;
|
|
},
|
|
};
|