feat: initialize PocketBase client with global auto-cancellation disabled and custom session expiry handling
This commit is contained in:
@@ -5,6 +5,9 @@ const pbUrl = import.meta.env.VITE_PB_URL ||
|
|||||||
|
|
||||||
export const pb = new PocketBase(pbUrl);
|
export const pb = new PocketBase(pbUrl);
|
||||||
|
|
||||||
|
// Globally disable auto cancellation to prevent React StrictMode from aborting requests
|
||||||
|
pb.autoCancellation(false);
|
||||||
|
|
||||||
// Detect auth portal session expiry: the portal returns HTML instead of JSON.
|
// Detect auth portal session expiry: the portal returns HTML instead of JSON.
|
||||||
// This prevents cryptic "Unexpected token '<'" errors when the session expires.
|
// This prevents cryptic "Unexpected token '<'" errors when the session expires.
|
||||||
pb.afterSend = function (response, data) {
|
pb.afterSend = function (response, data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user