// SPDX-License-Identifier: AGPL-3.0-or-later import type { DocwellClient } from "@docwell/api-client"; import { inject, type InjectionKey } from "vue"; export const apiKey: InjectionKey = Symbol("api"); /** Reads the current session token (for the collab WebSocket, which cannot use the client). */ export const tokenKey: InjectionKey<() => string | null> = Symbol("token"); export function useApi(): DocwellClient { return inject(apiKey)!; } export function useToken(): () => string | null { return inject(tokenKey)!; }