Skip to content

Commit

Permalink
Merge pull request #2 from Lotame/prebid_Selected_fixes
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
markaconrad authored Jun 18, 2020
2 parents 1c5e954 + 74bf928 commit 628cb21
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions modules/lotamePanoramaIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -226,7 +227,7 @@ export const lotamePanoramaIdSubmodule = {
utils.logError(error);
}
}
callback(responseObj);
callback(coreId);
},
undefined,
{
Expand Down

0 comments on commit 628cb21

Please sign in to comment.