( identifier: string, signal?: AbortSignal )
| 59 | } |
| 60 | |
| 61 | async function fetchDeployedChatConfig( |
| 62 | identifier: string, |
| 63 | signal?: AbortSignal |
| 64 | ): Promise<DeployedChatConfigResult> { |
| 65 | try { |
| 66 | const config = await requestJson(getDeployedChatConfigContract, { |
| 67 | params: { identifier }, |
| 68 | signal, |
| 69 | }) |
| 70 | return { kind: 'config', config } |
| 71 | } catch (error) { |
| 72 | if (error instanceof ApiClientError && error.status === 401) { |
| 73 | const authType = AUTH_ERROR_MAP[error.message] |
| 74 | if (authType) { |
| 75 | return { kind: 'auth', authType } |
| 76 | } |
| 77 | throw new Error('Unauthorized', { cause: error }) |
| 78 | } |
| 79 | |
| 80 | throw error |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Loads the public chat configuration for a deployed chat identifier. |
no test coverage detected