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

4
dist/bundle.js vendored
View file

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

View file

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