From 546ecd1f775925d771c4f86fe0e260ba38c25a02 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 8 Apr 2020 12:17:40 -0400 Subject: [PATCH] check if window exists before using --- dist/bundle.es.js | 4 +++- dist/bundle.js | 4 +++- src/lbryio.js | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 22cd74d..7c810b8 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -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); } }); diff --git a/dist/bundle.js b/dist/bundle.js index 6254544..ab1d459 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -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); } }); diff --git a/src/lbryio.js b/src/lbryio.js index 25047d0..53faabe 100644 --- a/src/lbryio.js +++ b/src/lbryio.js @@ -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); } }); -- 2.45.2