Created the postRequest function in the RequestUtil.js
This commit is contained in:
parent
34d775bf6f
commit
f8d9e6c1f4
@ -13,3 +13,12 @@ export const jsonRequest = async (path, headers = {}) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run a POST request and get the json of the response
|
||||||
|
export const postRequest = async (path, body = {}, headers = {}) => {
|
||||||
|
try {
|
||||||
|
return (await request(path, "POST", body, {...headers, "Content-Type": "application/json"})).json();
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user