feat: implement Anthropic API client with simulation support and add PocketBase configuration with session expiry handling
This commit is contained in:
@@ -4,3 +4,13 @@ const pbUrl = import.meta.env.VITE_PB_URL ||
|
||||
(typeof window !== 'undefined' ? window.location.origin : 'http://localhost:8090');
|
||||
|
||||
export const pb = new PocketBase(pbUrl);
|
||||
|
||||
// Detect auth portal session expiry: the portal returns HTML instead of JSON.
|
||||
// This prevents cryptic "Unexpected token '<'" errors when the session expires.
|
||||
pb.afterSend = function (response, data) {
|
||||
const contentType = response.headers.get('content-type') || '';
|
||||
if (contentType.includes('text/html')) {
|
||||
throw new Error('Your session has expired. Please refresh the page and log in again.');
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user