check if window exists before using #92

Merged
neb-b merged 1 commit from window into master 2020-04-08 18:49:35 +02:00
3 changed files with 9 additions and 3 deletions

4
dist/bundle.es.js vendored
View file

@ -367,7 +367,7 @@ Lbryio.getAuthToken = () => new Promise(resolve => {
Lbryio.overrides.getAuthToken().then(token => {
resolve(token);
});
} else {
} else if (typeof window !== 'undefined') {
const {
store
} = window;
@ -379,6 +379,8 @@ Lbryio.getAuthToken = () => new Promise(resolve => {
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});

4
dist/bundle.js vendored
View file

@ -932,7 +932,7 @@ Lbryio.getAuthToken = function () {
Lbryio.overrides.getAuthToken().then(function (token) {
resolve(token);
});
} else {
} else if (typeof window !== 'undefined') {
var _window = window,
store = _window.store;
@ -943,6 +943,8 @@ Lbryio.getAuthToken = function () {
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});

View file

@ -87,7 +87,7 @@ Lbryio.getAuthToken = () =>
Lbryio.overrides.getAuthToken().then(token => {
resolve(token);
});
} else {
} else if (typeof window !== 'undefined') {
const { store } = window;
if (store) {
const state = store.getState();
@ -96,6 +96,8 @@ Lbryio.getAuthToken = () =>
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});