Skip to content

Commit

Permalink
feat(settings-plans-billing): add dao type to the _updateSubscription
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 22, 2023
1 parent 28ecb45 commit fbabbe2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/components/dao/settings-plans-billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
},
methods: {
async checkout (id) {
async _createCheckoutSession (id) {
this.state = STATES.CREATING_SESSION
const res = await this.$apollo.mutate({
Expand Down Expand Up @@ -108,29 +108,32 @@ export default {
}
},
async upgrade (id) {
async _updateSubscription (id) {
this.state = STATES.CREATING_SESSION
const res = await this.$apollo.mutate({
mutation: gql`
mutation updateSubscription(
$daoType: String!
$priceId: String!
$subscriptionId: String!
$subscriptionItemId: String!
$priceId: String!
) {
updateSubscription(
daoType: $daoType
priceId: $priceId
subscriptionId: $subscriptionId
subscriptionItemId: $subscriptionItemId
priceId: $priceId
) {
id: planId
}
}
`,
variables: {
daoType: this.planType,
priceId: id,
subscriptionId: this.selectedDaoPlan.subscriptionId,
subscriptionItemId: this.selectedDaoPlan.subscriptionItemId,
priceId: id
subscriptionItemId: this.selectedDaoPlan.subscriptionItemId
}
})
Expand Down Expand Up @@ -253,7 +256,7 @@ export default {
q-btn.q-px-xl.rounded-border.text-bold.q-ml-xs(
:disable="selectedDaoPlan.id === plan.id"
:label="$t('configuration.settings-plans-billing.plan.modal.cta')"
@click="isFreePlan ? checkout(plan.id) : upgrade(plan.id)"
@click="isFreePlan ? _createCheckoutSession(plan.id) : _updateSubscription(plan.id)"
color="secondary"
no-caps
rounded
Expand Down

0 comments on commit fbabbe2

Please sign in to comment.