services.js
745 Bytes
import request from '../utils/request';
export function getService(token, url, app = undefined) {
try {
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
authorization: token,
},
};
const result = request(url, options, app);
return result;
} catch (e) {
console.log(e.message);
return {};
}
}
export function postValueService(token, value, url, app) {
try {
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
authorization: token,
},
body: JSON.stringify(value),
};
return request(url, options, app);
} catch (e) {
console.log(e.message);
return {};
}
}