|
|
|
|
@ -3,11 +3,19 @@ import map from 'lodash/map' |
|
|
|
|
import { API_ROOT } from 'config' |
|
|
|
|
import { callApi } from 'helpers' |
|
|
|
|
|
|
|
|
|
const buyMatchSubscription = (subscriptionId: number) => { |
|
|
|
|
import type { SubscriptionType } from 'features/BuyMatchPopup/types' |
|
|
|
|
|
|
|
|
|
type Subscription = { |
|
|
|
|
id: number, |
|
|
|
|
type: SubscriptionType, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const buyMatchSubscription = ({ id, type }: Subscription) => { |
|
|
|
|
const config = { |
|
|
|
|
body: { |
|
|
|
|
_p_interval: type, |
|
|
|
|
is_scheduled: 0, |
|
|
|
|
subscription_plan: subscriptionId, |
|
|
|
|
subscription_plan: id, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -17,6 +25,6 @@ const buyMatchSubscription = (subscriptionId: number) => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const buyMatchSubscriptions = (subscriptionIds: Array<number>) => ( |
|
|
|
|
Promise.all(map(subscriptionIds, buyMatchSubscription)) |
|
|
|
|
export const buyMatchSubscriptions = (subscriptions: Array<Subscription>) => ( |
|
|
|
|
Promise.all(map(subscriptions, buyMatchSubscription)) |
|
|
|
|
) |
|
|
|
|
|