1
0
forked from PGL/Clyde

link backend Post Patch Delete Lesson

This commit is contained in:
2024-04-16 22:03:48 +02:00
parent 9112004326
commit a2be04bfb3
17 changed files with 282 additions and 79 deletions

View File

@ -20,6 +20,10 @@ export async function restDelete(endPoint) {
return await _rest(endPoint, {method: "DELETE"});
}
export async function restDeleteItem(endPoint, data){
return await _rest(endPoint, {method: "DELETE", credentials: 'include', body: JSON.stringify(data)});
}
export async function restPatch(endPoint, data) {
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
}
@ -41,8 +45,9 @@ async function _rest(endPoint, config){
'Content-Type': 'application/json',
});
config['headers'] = config['headers'] == null ? headers : config['headers'];
console.log(config)
return toast.promise(fetch(restURL + endPoint, config),
{
{
pending: config['pending'] != null ? config['pending'] : 'pending',
error: config['error'] != null ? config['error'] : 'Network Failure...',
success: config['success'] != null ? config['success'] : {render(res){