author DomySh <me@domysh.com> 1656456810 +0200
committer DomySh <me@domysh.com> 1656457473 +0200

Small Fixes (Stable only with 1 worker!)
This commit is contained in:
DomySh
2022-06-29 00:53:30 +02:00
parent 80a38f0d50
commit fad6ad4e68
13 changed files with 80 additions and 127 deletions

View File

@@ -48,27 +48,6 @@ export async function postapi(path:string,data:any,is_form:boolean=false):Promis
});
}
export async function postform(path:string,data:any):Promise<any>{
return await new Promise((resolve, reject) => {
fetch(`/api/${path}`, {
method: 'POST',
credentials: "same-origin",
cache: 'no-cache',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
}).then(res => {
if(res.status === 401) window.location.reload()
if(!res.ok) reject(res.statusText)
res.json().then( res => resolve(res) ).catch( err => reject(err))
})
.catch(err => {
reject(err)
})
});
}
export function fireUpdateRequest(){
window.dispatchEvent(new Event(eventUpdateName))
}