Added API key authentication.
This commit is contained in:
@@ -79,7 +79,7 @@ export async function post(path, data, options = {}) {
|
||||
try {
|
||||
const res = await fetch(`/api${path}${getQuery(options.query)}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
body: data && JSON.stringify(data),
|
||||
...postHeaders,
|
||||
});
|
||||
|
||||
@@ -95,8 +95,6 @@ export async function post(path, data, options = {}) {
|
||||
return body;
|
||||
}
|
||||
|
||||
console.log(body.statusMessage);
|
||||
|
||||
showFeedback(false, options, body.statusMessage);
|
||||
throw new Error(body.statusMessage);
|
||||
} catch (error) {
|
||||
@@ -109,7 +107,7 @@ export async function patch(path, data, options = {}) {
|
||||
try {
|
||||
const res = await fetch(`/api${path}${getQuery(options.query)}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
body: data && JSON.stringify(data),
|
||||
...postHeaders,
|
||||
});
|
||||
|
||||
@@ -136,7 +134,7 @@ export async function del(path, options = {}) {
|
||||
try {
|
||||
const res = await fetch(`/api${path}${getQuery(options.query)}`, {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify(options.data),
|
||||
body: options.data && JSON.stringify(options.data),
|
||||
...postHeaders,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user