(userId?: string)
| 3 | import { HTTP } from '@/executor/constants' |
| 4 | |
| 5 | export async function buildAuthHeaders(userId?: string): Promise<Record<string, string>> { |
| 6 | const headers: Record<string, string> = { |
| 7 | 'Content-Type': HTTP.CONTENT_TYPE.JSON, |
| 8 | } |
| 9 | |
| 10 | if (typeof window === 'undefined') { |
| 11 | const token = await generateInternalToken(userId) |
| 12 | headers.Authorization = `Bearer ${token}` |
| 13 | } |
| 14 | |
| 15 | return headers |
| 16 | } |
| 17 | |
| 18 | export function buildAPIUrl(path: string, params?: Record<string, string>): URL { |
| 19 | const baseUrl = path.startsWith('/api/') ? getInternalApiBaseUrl() : getBaseUrl() |
no test coverage detected