This commit is contained in:
ntr
2019-08-13 15:44:17 +10:00
parent 143b0e92cb
commit 99c575ac69
11 changed files with 1761 additions and 0 deletions
+17
View File
@@ -204,6 +204,23 @@ function postData(url = '/', data = {}) {
});
}
function getData(url = '/', data = {}) {
// Default options are marked with *
return fetch(`/api${url}`, {
method: 'GET', // *GET, POST, PUT, DELETE, etc.
// mode: 'no-cors', // no-cors, cors, *same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'include', // include, same-origin, *omit
headers: {
Accept: 'application/json',
'content-type': 'application/json',
},
redirect: 'error', // manual, *follow, error
// referrer: ', // no-referrer, *client
body: JSON.stringify(data), // body data type must match "Content-Type" header
});
}
function errorToast(message) {
toast.error({
position: 'topRight',