Skip to content

Commit fd98191

Browse files
authored
Update settings controller
Take authEventHandled property out of oauthStatus object scope
1 parent 7bb3eea commit fd98191

File tree

1 file changed

+6
-7
lines changed
  • src/Umbraco.Cms.Integrations.Crm.Hubspot/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/js

1 file changed

+6
-7
lines changed

src/Umbraco.Cms.Integrations.Crm.Hubspot/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/js/settings.controller.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
const oauthName = "OAuth";
66

7-
vm.oauthSetup = {
8-
authEventHandled : false
9-
};
7+
vm.oauthSetup = {};
108
vm.status = {};
9+
vm.authEventHandled = false;
1110

1211
$scope.$on('formSubmitting', function () {
1312

@@ -51,7 +50,7 @@
5150
vm.onRevokeToken = function() {
5251
umbracoCmsIntegrationsCrmHubspotResource.revokeAccessToken().then(function (response) {
5352
vm.oauthSetup.isConnected = false;
54-
vm.oauthSetup.authEventHandled = false;
53+
vm.authEventHandled = false;
5554

5655
if(typeof $scope.connected === "undefined")
5756
notificationsService.success("HubSpot Configuration", "OAuth connection revoked.");
@@ -66,11 +65,11 @@
6665

6766
if (event.data.type === "hubspot:oauth:success") {
6867

69-
if (vm.oauthSetup.authEventHandled === true) return;
68+
if (vm.authEventHandled === true) return;
7069

7170
umbracoCmsIntegrationsCrmHubspotResource.getAccessToken(event.data.code).then(function (response) {
7271

73-
vm.oauthSetup.authEventHandled = true;
72+
vm.authEventHandled = true;
7473

7574
if (response.startsWith("Error:")) {
7675
if (typeof $scope.connected === "undefined")
@@ -115,4 +114,4 @@
115114
}
116115

117116
angular.module("umbraco")
118-
.controller("Umbraco.Cms.Integrations.Crm.Hubspot.SettingsController", settingsController);
117+
.controller("Umbraco.Cms.Integrations.Crm.Hubspot.SettingsController", settingsController);

0 commit comments

Comments
 (0)