import { request } from './api' import type { OrgBranding } from './types' export const orgApi = { branding: () => request('/org/branding'), setDisplayName: (display_name: string) => request('/org/branding', { method: 'PATCH', body: JSON.stringify({ display_name }) }), clearLogo: () => request('/org/logo', { method: 'DELETE' }), } // The logo is fetched by the browser as an image, not through the JSON client, so the session cookie // rides along automatically. The etag is appended so a replaced logo busts the cache immediately while // an unchanged one still hits the 304 path. export function orgLogoURL(b: OrgBranding | undefined): string | null { if (!b?.has_logo) return null return `/api/org/logo${b.logo_etag ? `?v=${encodeURIComponent(b.logo_etag)}` : ''}` }