fix: return if user is not present (#9768)
Fixes https://chatwoot-p3.sentry.io/share/issue/aa6a3c0accb345e984ed80eaddc3efd5/ In the case where the user is redirected to the page from a redirect like google login, the analytics helper breaks. This PR fixes it by checking if the user is present. This does not break the user email tracking since the user is redirected anyway and the `AnalyticsHelper` is reinitialised
This commit is contained in:
@@ -38,9 +38,10 @@ export class AnalyticsHelper {
|
||||
* @param {Object} user - User object
|
||||
*/
|
||||
identify(user) {
|
||||
if (!this.analytics) {
|
||||
if (!this.analytics || !user) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.user = user;
|
||||
this.analytics.identify(this.user.email, {
|
||||
userId: this.user.id,
|
||||
|
||||
Reference in New Issue
Block a user