battleship-front/src/scripts/requests.js
Administrator 915dbd4ed8 dev
2022-08-28 16:37:34 +03:00

17 lines
402 B
JavaScript

export const host = "http://battleship.develop.sprinthub.ru/"
function request(method, body, callback) {
const options = {
method: 'POST',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json'
}
};
fetch(host + "api/" + method, options)
.then(res => res.json())
.then(res => callback(res))
}
export default request;