aboutsummaryrefslogtreecommitdiffstats
path: root/web/composables/api.ts
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
commitecc6a55aba7bb35fc778e7a53848396b88214151 (patch)
tree1b37a2dc5f4594155114da1ae0c4529d20a4c548 /web/composables/api.ts
parent8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (diff)
Add multiple conferences feature
Diffstat (limited to 'web/composables/api.ts')
-rw-r--r--web/composables/api.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/web/composables/api.ts b/web/composables/api.ts
new file mode 100644
index 0000000..7881aff
--- /dev/null
+++ b/web/composables/api.ts
@@ -0,0 +1,14 @@
+export function $api<T>(
+ request: Parameters<typeof $fetch<T>>[0],
+ opts?: Parameters<typeof $fetch<T>>[1],
+) {
+ const authStore = useAuthStore()
+
+ return $fetch<T>(request, {
+ ...opts,
+ headers: {
+ Authorization: authStore.isLoggedIn() ? `Bearer ${authStore.token}` : '',
+ ...opts?.headers,
+ },
+ })
+}