1 import Medusa from "@medusajs/js-sdk"
2
3 export const backendUrl = __BACKEND_URL__ ?? "/"
4 const authType = __AUTH_TYPE__ ?? "session"
5 const jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || undefined
6
7 export const sdk = new Medusa({
8 baseUrl: backendUrl,
9 auth: {
10 type: authType,
11 jwtTokenStorageKey,
12 },
13 })
14
15 // useful when you want to call the BE from the console and try things out quickly
16 if (typeof window !== "undefined") {
17 ;(window as any).__sdk = sdk
18 }