1import { config } from '$lib/stores/settings.svelte';
 2
 3/**
 4 * Get authorization headers for API requests
 5 * Includes Bearer token if API key is configured
 6 */
 7export function getAuthHeaders(): Record<string, string> {
 8	const currentConfig = config();
 9	const apiKey = currentConfig.apiKey?.toString().trim();
10
11	return apiKey ? { Authorization: `Bearer ${apiKey}` } : {};
12}
13
14/**
15 * Get standard JSON headers with optional authorization
16 */
17export function getJsonHeaders(): Record<string, string> {
18	return {
19		'Content-Type': 'application/json',
20		...getAuthHeaders()
21	};
22}