From 40c72fef9547258dcf6800a57e70370cbf67ca09 Mon Sep 17 00:00:00 2001 From: Tyler-A Date: Thu, 30 Jul 2020 21:49:19 -0600 Subject: [PATCH] Compare state if in production mode --- src/App.vue | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/App.vue b/src/App.vue index 552554c..e8113d8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -41,23 +41,21 @@ export default { // Check to ensure the authorization was a success if (params.get(`access_token`)) { - // this.get_user() - // // Check if we compare state - // if (this.use_state) { + // Check if we compare state + if (process.env.NODE_ENV === `production`) { - // // Compare given state to localstorage state - // let LS_state = localStorage.getItem(`top-spotify-state`); - // if (LS_state == params.get(`state`)) { - // console.info(`State compare success`) - // return true - // } - // console.error(`State compare failed`) - // return false - // } else { - // return true - // } - return true + // Compare given state to localstorage state + let LS_state = localStorage.getItem(`top-spotify-state`); + if (LS_state == params.get(`state`)) { + console.info(`State compare success`) + return true + } + console.error(`State compare failed`) + return false + } else { + return true + } } else { let error = (new URLSearchParams(window.location.search)).get(`error`)