diff --git a/web/src/api.ts b/web/src/api.ts new file mode 100644 index 0000000..c245db5 --- /dev/null +++ b/web/src/api.ts @@ -0,0 +1,26 @@ +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, + }) +} \ No newline at end of file diff --git a/web/src/components/Autocomplete.vue b/web/src/components/Autocomplete.vue index 535d661..22d6472 100644 --- a/web/src/components/Autocomplete.vue +++ b/web/src/components/Autocomplete.vue @@ -1,6 +1,6 @@