Added basic comments.
This commit is contained in:
@@ -15,7 +15,7 @@ function getQuery(data) {
|
||||
}
|
||||
|
||||
export async function get(path, query = {}) {
|
||||
const res = await fetch(`${path}${getQuery(query)}`);
|
||||
const res = await fetch(`/api${path}${getQuery(query)}`);
|
||||
const body = await res.json();
|
||||
|
||||
if (res.ok) {
|
||||
@@ -26,7 +26,7 @@ export async function get(path, query = {}) {
|
||||
}
|
||||
|
||||
export async function post(path, data, { query } = {}) {
|
||||
const res = await fetch(`${path}${getQuery(query)}`, {
|
||||
const res = await fetch(`/api${path}${getQuery(query)}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
...postHeaders,
|
||||
@@ -46,7 +46,7 @@ export async function post(path, data, { query } = {}) {
|
||||
}
|
||||
|
||||
export async function patch(path, data, { query } = {}) {
|
||||
const res = await fetch(`${path}${getQuery(query)}`, {
|
||||
const res = await fetch(`/api${path}${getQuery(query)}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
...postHeaders,
|
||||
@@ -66,7 +66,7 @@ export async function patch(path, data, { query } = {}) {
|
||||
}
|
||||
|
||||
export async function del(path, { data, query } = {}) {
|
||||
const res = await fetch(`${path}${getQuery(query)}`, {
|
||||
const res = await fetch(`/api${path}${getQuery(query)}`, {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify(data),
|
||||
...postHeaders,
|
||||
|
||||
@@ -2,3 +2,7 @@
|
||||
export default function navigate(path) {
|
||||
window.location.href = path;
|
||||
}
|
||||
|
||||
export function reload() {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user