27 lines
703 B
TypeScript
27 lines
703 B
TypeScript
import { useSessionStore } from "./stores/session";
|
|
|
|
export const BASE_URL = "/api/v1";
|
|
|
|
export function GET(path: string) {
|
|
const sessionStore = useSessionStore();
|
|
return fetch(BASE_URL + path, {
|
|
headers: sessionStore.AuthHeaders,
|
|
});
|
|
}
|
|
|
|
export function POST(path: string, body: FormData | string | null) {
|
|
const sessionStore = useSessionStore();
|
|
return fetch(BASE_URL + path, {
|
|
method: "POST",
|
|
headers: sessionStore.AuthHeaders,
|
|
body: body,
|
|
});
|
|
}
|
|
export function DELETE(path: string) {
|
|
const sessionStore = useSessionStore();
|
|
return fetch(BASE_URL + path, {
|
|
method: "DELETE",
|
|
headers: sessionStore.AuthHeaders,
|
|
});
|
|
}
|