From 74bf928a835005c8e9816540cbffa828bd465ddb Mon Sep 17 00:00:00 2001 From: Mark Conrad Date: Thu, 18 Jun 2020 15:10:11 -0400 Subject: [PATCH] From PR feedback Only care about the core_id if a profile_id is also returned so it won't look like we can store a core_id and then promptly delete it Return just the core_id from getId() --- modules/lotamePanoramaIdSystem.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/lotamePanoramaIdSystem.js b/modules/lotamePanoramaIdSystem.js index beaad46d8b3..cdf9131dd68 100644 --- a/modules/lotamePanoramaIdSystem.js +++ b/modules/lotamePanoramaIdSystem.js @@ -200,24 +200,25 @@ export const lotamePanoramaIdSubmodule = { ajax( url, (response) => { - let responseObj = {}; + let coreId; if (response) { try { - responseObj = JSON.parse(response); + let responseObj = JSON.parse(response); saveLotameCache(KEY_EXPIRY, responseObj.expiry_ts); - if (utils.isStr(responseObj.core_id)) { - saveLotameCache( - KEY_ID, - responseObj.core_id, - responseObj.expiry_ts - ); - } else { - clearLotameCache(KEY_ID); - } - if (utils.isStr(responseObj.profile_id)) { setProfileId(responseObj.profile_id); + + if (utils.isStr(responseObj.core_id)) { + saveLotameCache( + KEY_ID, + responseObj.core_id, + responseObj.expiry_ts + ); + coreId = responseObj.core_id; + } else { + clearLotameCache(KEY_ID); + } } else { clearLotameCache(KEY_PROFILE); clearLotameCache(KEY_ID); @@ -226,7 +227,7 @@ export const lotamePanoramaIdSubmodule = { utils.logError(error); } } - callback(responseObj); + callback(coreId); }, undefined, {