Skip to content

Commit

Permalink
Merge pull request #701 from peaemaye/ServiceRejectIssue
Browse files Browse the repository at this point in the history
Fix service reject issue & setCookieData() method deletes lastConsentTimestamp field
  • Loading branch information
orestbida authored Jul 2, 2024
2 parents c4d512f + 8785e50 commit da3ca52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,13 @@ const retrieveState = () => {
* and calculate acceptType
*/
if (!state._invalidConsent) {
state._enabledServices = {...state._acceptedServices};

state._acceptedServices = {
...state._acceptedServices,
...services
};

state._enabledServices = {...state._acceptedServices};

setAcceptedCategories([
...state._readOnlyCategories,
...categories
Expand Down
4 changes: 4 additions & 0 deletions src/utils/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ export const saveCookiePreferences = () => {
consentId: state._consentId,
services: deepCopy(state._acceptedServices)
};

if (state._lastConsentTimestamp) {
state._savedCookieContent.lastConsentTimestamp = state._lastConsentTimestamp.toISOString();
}

let isFirstConsent = false;
const stateChanged = categoriesWereChanged || servicesWereChanged;
Expand Down

0 comments on commit da3ca52

Please sign in to comment.