to_inventory/front/utils/apiCall.ts

7 lines
285 B
TypeScript

import { apiBase } from '~/helpers';
export default async function <T>(path: string, method = 'GET', body = null) {
const headers = new Headers();
headers.append("Content-Type", "application/json");
return await $fetch<T>(`${apiBase}/${path}`, { method, headers, body })
}