export function getApiErrorMessage(err: unknown): string | null { if (!err || typeof err !== 'object') return null const anyErr = err as Record const response = anyErr.response as Record | undefined const data = response?.data as Record | undefined const msg = data?.error return typeof msg === 'string' ? msg : null }