mirror of
https://github.com/bitwarden/web
synced 2025-12-17 16:53:14 +00:00
refactor to remove deprecated apis
This commit is contained in:
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
_service.organizations = $resource(_apiUri + '/organizations/:id', {}, {
|
_service.organizations = $resource(_apiUri + '/organizations/:id', {}, {
|
||||||
get: { method: 'GET', params: { id: '@id' } },
|
get: { method: 'GET', params: { id: '@id' } },
|
||||||
getExtended: { url: _apiUri + '/organizations/:id/extended', method: 'GET', params: { id: '@id' } },
|
|
||||||
list: { method: 'GET', params: {} },
|
list: { method: 'GET', params: {} },
|
||||||
post: { method: 'POST', params: {} },
|
post: { method: 'POST', params: {} },
|
||||||
put: { method: 'POST', params: { id: '@id' } },
|
put: { method: 'POST', params: { id: '@id' } },
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ angular
|
|||||||
return _setDeferred.promise;
|
return _setDeferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
_service.addProfileOrganization = function (org) {
|
_service.addProfileOrganizationOwner = function (org, key) {
|
||||||
return _service.getUserProfile().then(function (profile) {
|
return _service.getUserProfile().then(function (profile) {
|
||||||
if (profile) {
|
if (profile) {
|
||||||
if (!profile.organizations) {
|
if (!profile.organizations) {
|
||||||
@@ -128,7 +128,7 @@ angular
|
|||||||
var o = {
|
var o = {
|
||||||
id: org.Id,
|
id: org.Id,
|
||||||
name: org.Name,
|
name: org.Name,
|
||||||
key: org.Key,
|
key: key,
|
||||||
status: 2, // 2 = Confirmed
|
status: 2, // 2 = Confirmed
|
||||||
type: 0 // 0 = Owner
|
type: 0 // 0 = Owner
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,11 +34,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.submit = function (model) {
|
$scope.submit = function (model) {
|
||||||
|
var shareKey = cryptoService.makeShareKey();
|
||||||
|
|
||||||
$scope.submitPromise = stripe.card.createToken(model.card).then(function (response) {
|
$scope.submitPromise = stripe.card.createToken(model.card).then(function (response) {
|
||||||
var request = {
|
var request = {
|
||||||
name: model.name,
|
name: model.name,
|
||||||
planType: model.plan,
|
planType: model.plan,
|
||||||
key: cryptoService.makeShareKey(),
|
key: shareKey,
|
||||||
cardToken: response.id,
|
cardToken: response.id,
|
||||||
additionalUsers: model.additionalUsers,
|
additionalUsers: model.additionalUsers,
|
||||||
billingEmail: model.billingEmail,
|
billingEmail: model.billingEmail,
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
|
|
||||||
$uibModalInstance.dismiss('cancel');
|
$uibModalInstance.dismiss('cancel');
|
||||||
$analytics.eventTrack('Created Organization');
|
$analytics.eventTrack('Created Organization');
|
||||||
authService.addProfileOrganization(result);
|
authService.addProfileOrganizationOwner(result, shareKey);
|
||||||
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function () {
|
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function () {
|
||||||
toastr.success('Your new organization is ready to go!', 'Organization Created');
|
toastr.success('Your new organization is ready to go!', 'Organization Created');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user