Skip to content

Commit a57d4ae

Browse files
chore: wip
1 parent 0b0fded commit a57d4ae

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

resources/stores/payment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const usePaymentStore = defineStore('payment', {
4949
return client
5050
},
5151

52-
async cancelPlan(): Promise<string> {
52+
async cancelPlan(): Promise<void> {
5353
const url = 'http://localhost:3008/stripe/cancel-subscription'
5454

5555
const providerId = this.getCurrentPlan.subscription.provider_id
@@ -169,6 +169,8 @@ export const usePaymentStore = defineStore('payment', {
169169
const res = await response.json()
170170

171171
this.activeSubscription = res
172+
} else {
173+
this.activeSubscription = {}
172174
}
173175
},
174176
},

resources/views/dashboard/components/billing/active-plan.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ async function cancelPlan() {
1010
1111
await paymentStore.fetchUserActivePlan()
1212
}
13+
14+
const subscriptionType = computed(() => {
15+
const type = paymentStore.getCurrentPlan.subscription.type
16+
17+
return type.charAt(0).toUpperCase() + type.slice(1)
18+
})
19+
20+
const nextPayment = computed(() => {
21+
return convertUnixTimestampToDate(paymentStore.getCurrentPlan.providerSubscription.current_period_end)
22+
})
23+
24+
const unitPrice = computed(() => {
25+
return paymentStore.getCurrentPlan.subscription.unit_price / 100
26+
})
1327
</script>
1428

1529
<template>
@@ -20,15 +34,15 @@ async function cancelPlan() {
2034

2135
<div class="pt-2">
2236
<p class="text-gray-700 font-bold">
23-
{{ paymentStore.getCurrentPlan.subscription.type }} Plan
37+
{{ subscriptionType }} Plan
2438
</p>
2539

2640
<p class="pt-2 text-sm text-gray-500 font-normal italic">
2741
{{ paymentStore.getCurrentPlan.subscription.description }}
2842
</p>
2943

3044
<p class="pt-4 text-sm text-gray-700 font-semibold">
31-
Next payment of ${{ paymentStore.getCurrentPlan.subscription.unit_price / 100 }} occurs on {{ convertUnixTimestampToDate(paymentStore.getCurrentPlan.providerSubscription.current_period_end) }}
45+
Next payment of ${{ unitPrice }} occurs on {{ nextPayment }}
3246
</p>
3347
</div>
3448

resources/views/dashboard/components/billing/payment-method-list.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ async function makeDefault(paymentMethodId: string) {
4141
</svg>
4242
</button>
4343

44-
<button
45-
type="button"
46-
class="border rounded-md bg-white px-2 py-1 text-sm text-white font-semibold shadow-sm hover:bg-blue-gray-50 focus-visible:outline-2 focus-visible:outline-blue-600 focus-visible:outline-offset-2 focus-visible:outline"
47-
>
48-
<svg class="h-4 w-4 text-gray-700" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
49-
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
50-
</svg>
51-
</button>
52-
5344
<button
5445
aria-label="delete"
5546
type="button"

0 commit comments

Comments
 (0)