File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed
views/dashboard/components/billing Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export const usePaymentStore = defineStore('payment', {
49
49
return client
50
50
} ,
51
51
52
- async cancelPlan ( ) : Promise < string > {
52
+ async cancelPlan ( ) : Promise < void > {
53
53
const url = 'http://localhost:3008/stripe/cancel-subscription'
54
54
55
55
const providerId = this . getCurrentPlan . subscription . provider_id
@@ -169,6 +169,8 @@ export const usePaymentStore = defineStore('payment', {
169
169
const res = await response . json ( )
170
170
171
171
this . activeSubscription = res
172
+ } else {
173
+ this . activeSubscription = { }
172
174
}
173
175
} ,
174
176
} ,
Original file line number Diff line number Diff line change @@ -10,6 +10,20 @@ async function cancelPlan() {
10
10
11
11
await paymentStore .fetchUserActivePlan ()
12
12
}
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
+ })
13
27
</script >
14
28
15
29
<template >
@@ -20,15 +34,15 @@ async function cancelPlan() {
20
34
21
35
<div class =" pt-2" >
22
36
<p class =" text-gray-700 font-bold" >
23
- {{ paymentStore.getCurrentPlan.subscription.type }} Plan
37
+ {{ subscriptionType }} Plan
24
38
</p >
25
39
26
40
<p class =" pt-2 text-sm text-gray-500 font-normal italic" >
27
41
{{ paymentStore.getCurrentPlan.subscription.description }}
28
42
</p >
29
43
30
44
<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 }}
32
46
</p >
33
47
</div >
34
48
Original file line number Diff line number Diff line change @@ -41,15 +41,6 @@ async function makeDefault(paymentMethodId: string) {
41
41
</svg >
42
42
</button >
43
43
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
-
53
44
<button
54
45
aria-label =" delete"
55
46
type =" button"
You can’t perform that action at this time.
0 commit comments