link backend Post Patch Delete Lesson
This commit is contained in:
@ -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){
|
||||
|
Reference in New Issue
Block a user