Skip to content

Commit 71c689c

Browse files
GitskoCopilot
andcommitted
Update src/widgets/Base.js
Co-authored-by: Copilot <[email protected]>
1 parent 2773b4e commit 71c689c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/widgets/Base.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,18 @@ class Base {
248248
cmp.waitForCmp(async () => {
249249
try {
250250
const consent = await cmp.getConsent(this.cfg.ucId);
251-
const hasConsent = consent === true || (consent && typeof consent.then === 'function' && await consent);
251+
let hasConsent = false;
252+
if (consent === true) {
253+
hasConsent = true;
254+
} else if (consent && typeof consent.then === 'function') {
255+
try {
256+
hasConsent = await consent;
257+
} catch (e) {
258+
hasConsent = false;
259+
}
260+
} else if (consent) {
261+
hasConsent = Boolean(consent);
262+
}
252263

253264
if (hasConsent && this.container && !this.isActivated) {
254265
// Trigger click on accept button to activate properly

0 commit comments

Comments
 (0)