Merge pull request #92 from lbryio/window
check if window exists before using
This commit is contained in:
commit
0addc624db
3 changed files with 9 additions and 3 deletions
4
dist/bundle.es.js
vendored
4
dist/bundle.es.js
vendored
|
@ -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
4
dist/bundle.js
vendored
|
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue