From acc214d7c1b7cff463fd0ea60d6cbbcd1e1f2d53 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 5 Apr 2017 16:14:52 -0400 Subject: [PATCH] refactor to remove deprecated apis --- src/app/services/apiService.js | 1 - src/app/services/authService.js | 4 ++-- src/app/settings/settingsCreateOrganizationController.js | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/services/apiService.js b/src/app/services/apiService.js index 813b30ad3b..59054fb0a9 100644 --- a/src/app/services/apiService.js +++ b/src/app/services/apiService.js @@ -35,7 +35,6 @@ _service.organizations = $resource(_apiUri + '/organizations/:id', {}, { get: { method: 'GET', params: { id: '@id' } }, - getExtended: { url: _apiUri + '/organizations/:id/extended', method: 'GET', params: { id: '@id' } }, list: { method: 'GET', params: {} }, post: { method: 'POST', params: {} }, put: { method: 'POST', params: { id: '@id' } }, diff --git a/src/app/services/authService.js b/src/app/services/authService.js index b3c1b60fce..31f29e5f58 100644 --- a/src/app/services/authService.js +++ b/src/app/services/authService.js @@ -118,7 +118,7 @@ angular return _setDeferred.promise; }; - _service.addProfileOrganization = function (org) { + _service.addProfileOrganizationOwner = function (org, key) { return _service.getUserProfile().then(function (profile) { if (profile) { if (!profile.organizations) { @@ -128,7 +128,7 @@ angular var o = { id: org.Id, name: org.Name, - key: org.Key, + key: key, status: 2, // 2 = Confirmed type: 0 // 0 = Owner }; diff --git a/src/app/settings/settingsCreateOrganizationController.js b/src/app/settings/settingsCreateOrganizationController.js index d590b9b4f8..58b884a1b0 100644 --- a/src/app/settings/settingsCreateOrganizationController.js +++ b/src/app/settings/settingsCreateOrganizationController.js @@ -34,11 +34,13 @@ }; $scope.submit = function (model) { + var shareKey = cryptoService.makeShareKey(); + $scope.submitPromise = stripe.card.createToken(model.card).then(function (response) { var request = { name: model.name, planType: model.plan, - key: cryptoService.makeShareKey(), + key: shareKey, cardToken: response.id, additionalUsers: model.additionalUsers, billingEmail: model.billingEmail, @@ -52,7 +54,7 @@ $uibModalInstance.dismiss('cancel'); $analytics.eventTrack('Created Organization'); - authService.addProfileOrganization(result); + authService.addProfileOrganizationOwner(result, shareKey); $state.go('backend.org.dashboard', { orgId: result.Id }).then(function () { toastr.success('Your new organization is ready to go!', 'Organization Created'); });