drop some types in

This commit is contained in:
Thomas Ruoff
2021-02-14 22:47:44 +01:00
parent 81db4b5d0e
commit 85a7b54a13
13 changed files with 116 additions and 45 deletions

View File

@@ -1,3 +1,5 @@
import { ILatest } from '../interfaces/ILatest'
function checkStatus(res: Response) {
if (res.status < 200 || res.status >= 400) {
throw new Error(`Something went wrong (Status ${res.status}) - I do feel very sorry!`)
@@ -18,7 +20,7 @@ export async function generatePdf(state: Record<string, string>) {
return response.json()
}
export async function getLatest() {
export async function getLatest(): Promise<ILatest[]> {
const response = await fetch('/api/pdf/latest')
checkStatus(response)
return response.json()