diff --git a/lib/boot.js b/lib/boot.js index 1154c558c..b6a182c2c 100644 --- a/lib/boot.js +++ b/lib/boot.js @@ -42,6 +42,19 @@ const appProvider = 'simplenote.com'; const appID = config.app_id; let token = cookie.token || localStorage.access_token; +// Signs out the user from app engine and redirects to signin page +const redirectToWebSigninIfNecessary = () => { + if (!config.is_app_engine) { + return; + } + + if (window.webConfig && window.webConfig.signout) { + window.webConfig.signout(function() { + window.location = `${config.app_engine_url}/`; + }); + } +}; + // Redirect to web sign in if running on App Engine if (!token && config.is_app_engine) { redirectToWebSigninIfNecessary(); @@ -213,19 +226,6 @@ const resetStorageIfAccountChanged = newAccountName => { } }; -// Signs out the user from app engine and redirects to signin page -const redirectToWebSigninIfNecessary = () => { - if (!config.is_app_engine) { - return; - } - - if (window.webConfig && window.webConfig.signout) { - window.webConfig.signout(function() { - window.location = `${config.app_engine_url}/`; - }); - } -}; - // Set account email if app engine provided it if (cookie.email && config.is_app_engine) { // If the stored email doesn't match, we should reset the app storage