ApiQuery.js
Home
/
FileServer /
SPA /
src /
JS /
Tools /
ApiQuery.js
import Log from './LogTools'
import Notification from './Notification'
export default function ApiQuery(url, method, data) {
Log("ApiQuery", "query to " + url);
return fetch(
url,
{
method: method,
headers: {
'Content-Type': 'application/json'
},
credentials: 'include',
body: JSON.stringify(data)
}
).then(function (response) {
return response.json();
}).catch(
function () {
Notification.MesEr("Api query error", "ApiQuery");
throw "";
}
);
}