add prettier and format all

This commit is contained in:
Thomas Ruoff
2021-02-08 22:51:35 +01:00
parent d7044f5f78
commit 78af180567
24 changed files with 266 additions and 297 deletions

View File

@@ -1,32 +1,31 @@
function checkStatus(res) {
if (res.status < 200 || res.status >= 400) {
throw new Error(`Something went wrong (Status ${res.status}) - I do feel very sorry!`);
}
if (res.status < 200 || res.status >= 400) {
throw new Error(`Something went wrong (Status ${res.status}) - I do feel very sorry!`)
}
return res;
return res
}
export function generatePdf(state){
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(state)
};
export function generatePdf(state) {
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(state),
}
return fetch('/api/pdf/generate/brief', options)
.then(checkStatus)
.then(res => res.json());
return fetch('/api/pdf/generate/brief', options)
.then(checkStatus)
.then((res) => res.json())
}
export function getLatest() {
return fetch('/api/pdf/latest')
.then(checkStatus)
.then(res => res.json());
return fetch('/api/pdf/latest')
.then(checkStatus)
.then((res) => res.json())
}
export function removeLatest(item) {
return fetch(`/api/pdf/latest/${item.id}`, {method: 'DELETE'})
.then(checkStatus);
return fetch(`/api/pdf/latest/${item.id}`, { method: 'DELETE' }).then(checkStatus)
}