Die Abfragen werden erfolgreich vom Server verarbeitet.

This commit is contained in:
2021-04-13 15:18:51 +02:00
parent 2e0e6db55a
commit 74193f3b46
+8 -12
View File
@@ -52,19 +52,17 @@
console.log(err); console.log(err);
}); });
}, },
'add': record => { 'add': async record => {
console.log(record); console.log(record);
// noinspection JSUnresolvedVariable // noinspection JSUnresolvedVariable
fetch(env.API_URL + '/working-hours', { await fetch(env.API_URL + '/working-hours', {
method: 'POST', method: 'POST',
mode: 'no-cors', mode: 'cors',
cache: 'no-cache', cache: 'no-cache',
credentials: 'same-origin', credentials: 'omit',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(record) body: JSON.stringify(record)
}) })
.then(res => { .then(res => {
@@ -79,19 +77,17 @@
console.log(err); console.log(err);
}); });
}, },
'update': (date, record) => { 'update': async (date, record) => {
console.log(record); console.log(record);
// noinspection JSUnresolvedVariable // noinspection JSUnresolvedVariable
fetch(env.API_URL + '/working-hours/' + date, { await fetch(env.API_URL + '/working-hours/' + date, {
method: 'PUT', method: 'PUT',
mode: 'no-cors', mode: 'cors',
cache: 'no-cache', cache: 'no-cache',
credentials: 'same-origin', credentials: 'omit',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(record) body: JSON.stringify(record)
}) })
.then(res => { .then(res => {