feat: implement Anthropic API client with simulation support and add PocketBase configuration with session expiry handling
All checks were successful
On Push to Main / test (push) Successful in 30s
On Push to Main / publish (push) Successful in 58s
On Push to Main / deploy-dev (push) Successful in 1m33s

This commit is contained in:
RaymondVerhoef
2026-05-17 14:27:31 +02:00
parent 775c3030d5
commit 77d411b77e
2 changed files with 16 additions and 0 deletions

View File

@@ -46,6 +46,12 @@ export const anthropicApi = {
throw new Error(`API Error: ${response.status} ${response.statusText} - ${JSON.stringify(errData)}`);
}
// Detect auth portal session expiry: the portal returns HTML instead of JSON
const contentType = response.headers.get('content-type') || '';
if (!contentType.includes('application/json')) {
throw new Error('Your session has expired. Please refresh the page and log in again.');
}
const data = await response.json();
return data.content[0].text;
} catch (error) {