Files

14 lines
523 B
TypeScript

import { createApi } from "@vmall/shared";
// Mobile is live-only: the fixed-data adapter exists for the mall's demo
// rollback; a fresh app has nothing to roll back from. All data still flows
// exclusively through the @vmall/shared contract.
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig();
const api = createApi({
baseUrl: config.public.apiBase as string,
getToken: () => (import.meta.client ? localStorage.getItem("vmall.token") : null),
});
return { provide: { api } };
});