Skip to content

Commit

Permalink
fix: condition to check fcWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhy-Deriv committed Nov 21, 2024
1 parent ac431c0 commit 4028954
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions public/scripts/freshchat/freshchat-1.0.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ class FreshChat {

script.onload = function () {
if (jwt) {
window.fcWidget?.user?.setProperties({
cf_user_jwt: jwt,
});
const checkWidget = setInterval(() => {
if (window.fcWidget?.user) {
window.fcWidget.user?.setProperties({
cf_user_jwt: jwt,
});
clearInterval(checkWidget);
}
}, 500);
}
};
};
Expand Down

0 comments on commit 4028954

Please sign in to comment.