Add catches around calls to external services that might break login
This commit is contained in:
parent
dc95f36f66
commit
486facedbe
1 changed files with 32 additions and 20 deletions
|
@ -37,32 +37,44 @@ function(ApiService, CookieService, $rootScope, Config) {
|
|||
|
||||
if (!userResponse.anonymous) {
|
||||
if (Config.MIXPANEL_KEY) {
|
||||
mixpanel.identify(userResponse.username);
|
||||
mixpanel.people.set({
|
||||
'$email': userResponse.email,
|
||||
'$username': userResponse.username,
|
||||
'verified': userResponse.verified
|
||||
});
|
||||
mixpanel.people.set_once({
|
||||
'$created': new Date()
|
||||
})
|
||||
try {
|
||||
mixpanel.identify(userResponse.username);
|
||||
mixpanel.people.set({
|
||||
'$email': userResponse.email,
|
||||
'$username': userResponse.username,
|
||||
'verified': userResponse.verified
|
||||
});
|
||||
mixpanel.people.set_once({
|
||||
'$created': new Date()
|
||||
})
|
||||
} catch (e) {
|
||||
window.console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.olark !== undefined) {
|
||||
olark('api.visitor.getDetails', function(details) {
|
||||
if (details.fullName === null) {
|
||||
olark('api.visitor.updateFullName', {fullName: userResponse.username});
|
||||
}
|
||||
});
|
||||
olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email});
|
||||
olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username});
|
||||
try {
|
||||
olark('api.visitor.getDetails', function(details) {
|
||||
if (details.fullName === null) {
|
||||
olark('api.visitor.updateFullName', {fullName: userResponse.username});
|
||||
}
|
||||
});
|
||||
olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email});
|
||||
olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username});
|
||||
} catch (e) {
|
||||
window.console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.Raven !== undefined) {
|
||||
Raven.setUser({
|
||||
email: userResponse.email,
|
||||
id: userResponse.username
|
||||
});
|
||||
try {
|
||||
Raven.setUser({
|
||||
email: userResponse.email,
|
||||
id: userResponse.username
|
||||
});
|
||||
} catch (e) {
|
||||
window.console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
CookieService.putPermanent('quay.loggedin', 'true');
|
||||
|
|
Reference in a new issue