Merge pull request #92 from lbryio/window

check if window exists before using
This commit is contained in:
Sean Yesmunt 2020-04-08 12:49:35 -04:00 committed by GitHub
commit 0addc624db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
} }
}); });