
async function del(url, data) {
  return await _fetch(url, data, "DELETE");
}

async function _fetch(url, data, method) {
  const response = await fetch(url, {
    method: method,
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
      'RequestVerificationToken': jfa.page.getAntiForgeryToken()
    },
    body: data ? JSON.stringify(data) : data
  });
  return response;
}

async function post(url, data) {
  return await _fetch(url, data, "POST");
}

export default {
  delete: del,
  post: post
};
