diff --git a/src/_services/network.service.js b/src/_services/network.service.js index 6556ec7..3942567 100644 --- a/src/_services/network.service.js +++ b/src/_services/network.service.js @@ -21,7 +21,7 @@ function getNearestRegions(userId, footprint, messages, errors) { return fetch(`${config.apiUrl}/me/regions/closest${footprintParam}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } -function startNetwork(userId, planId, cloud, region) { +function startNetwork(userId, planId, cloud, region, messages, errors) { const cloudAndRegion = (typeof cloud === 'undefined' || typeof region === 'undefined' || cloud === null || region === null) ? "" : `?cloud=${cloud}®ion=${region}`; - return fetch(`${config.apiUrl}/networks/${planId}/actions/start${cloudAndRegion}`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/networks/${planId}/actions/start${cloudAndRegion}`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors)); } \ No newline at end of file diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index 04d69eb..3f19c52 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -39,7 +39,7 @@ const actions = { accountPlanService.newAccountPlan(account.state.user.uuid, accountPlan, messages, errors) .then( plan => { - networkService.startNetwork(account.state.user.uuid, plan.name, cloud, region) + networkService.startNetwork(account.state.user.uuid, plan.name, cloud, region, messages, errors) .then( network => commit('addPlanAndStartNetworkSuccess', network), error => commit('addPlanSuccessStartNetworkFailure', error) diff --git a/src/account/NewNetworkPage.vue b/src/account/NewNetworkPage.vue index 897a5f1..c10102b 100644 --- a/src/account/NewNetworkPage.vue +++ b/src/account/NewNetworkPage.vue @@ -192,6 +192,7 @@ plan: 'bubble', footprint: 'Worldwide', paymentMethodObject: { + uuid: null, paymentMethodType: null, paymentInfo: null } @@ -230,7 +231,7 @@ ...mapState('domains', ['domains']), ...mapState('plans', ['plans']), ...mapState('footprints', ['footprints']), - ...mapState('paymentMethods', ['paymentMethods', 'paymentMethod', 'paymentInfo']), + ...mapState('paymentMethods', ['paymentMethods', 'accountPaymentMethod', 'paymentMethod', 'paymentInfo']), ...mapState('networks', ['nearestRegions']), ...mapState('networks', { error: state => state.error @@ -389,10 +390,6 @@ this.$validator.validate().then(valid => { if (valid) { if (this.paymentInfo) { - this.accountPlan.paymentMethodObject = { - paymentMethodType: this.paymentMethod.paymentMethodType, - paymentInfo: this.paymentInfo - }; const cloudRegion = this.findRegion(this.cloudRegionUuid); if (cloudRegion === null) { console.log('no region selected'); @@ -449,6 +446,12 @@ this.accountPlan.paymentMethodObject.paymentInfo = info; } }, + accountPaymentMethod (apm) { + if (apm) { + console.log('watch.accountPaymentMethod: set uuid from: '+JSON.stringify(apm)); + this.accountPlan.paymentMethodObject.uuid = apm.uuid + } + }, policy (p) { this.anyContacts = this.hasAnyContacts(p); this.verifiedContacts = this.hasVerifiedContact(p);