subscription dialog
This commit is contained in:
committed by
Eric Bailey
parent
9be5761885
commit
0f15abc246
@@ -1,23 +1,21 @@
|
||||
import {useMutation} from '@tanstack/react-query'
|
||||
|
||||
import {IS_DEV} from '#/env'
|
||||
import {api} from '#/state/purchases/subscriptions/api'
|
||||
import {IS_DEV} from '#/env'
|
||||
|
||||
export function useCreateCheckout() {
|
||||
return useMutation({
|
||||
async mutationFn(props: {
|
||||
price: string,
|
||||
did: string,
|
||||
email: string,
|
||||
}) {
|
||||
async mutationFn(props: {price: string; did: string; email: string}) {
|
||||
const {data, error} = await api<{
|
||||
checkoutUrl: string
|
||||
}>('/checkout/create', {
|
||||
method: 'POST',
|
||||
json: {
|
||||
...props,
|
||||
redirectUrl: IS_DEV ? `http://localhost:19006/subscriptions` : `https://bsky.app/subscriptions`,
|
||||
}
|
||||
redirectUrl: IS_DEV
|
||||
? `http://localhost:19006/subscriptions`
|
||||
: `https://bsky.app/subscriptions`,
|
||||
},
|
||||
}).json()
|
||||
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user