touch window only if it is defined

Paul Fitzpatrick 3 weeks ago
parent a63fea5028
commit 95b06a910f
No known key found for this signature in database
GPG Key ID: 07F16BF3214888F6

@ -61,7 +61,7 @@ export class BaseAPI {
'X-Requested-With': 'XMLHttpRequest',
...options.headers
};
if ((window as any)?.isGristBootPage) {
if (typeof window !== 'undefined' && (window as any)?.isGristBootPage) {
const parts = (new URL(window.location.href).pathname).split('/');
if (parts[0] === '' && parts[1] === 'boot' && parts[2] !== undefined) {
this._headers['X-Boot-Key'] = parts[2];

Loading…
Cancel
Save