there is a situation in tests where window is defined but window.location is undefined

This commit is contained in:
Paul Fitzpatrick 2024-05-13 18:20:58 -04:00
parent 8645128b89
commit 19f40085fa
No known key found for this signature in database
GPG Key ID: 07F16BF3214888F6

View File

@ -66,7 +66,7 @@ export class BaseAPI {
// This is a fallback mechanism if auth is broken to access the
// admin panel.
// TODO: should this be more selective?
if (typeof window !== 'undefined') {
if (typeof window !== 'undefined' && window.location) {
const url = new URL(window.location.href);
const bootKey = url.searchParams.get('boot');
if (bootKey) {