|
|
|
@ -5,7 +5,6 @@ import { |
|
|
|
useCallback, |
|
|
|
useCallback, |
|
|
|
} from 'react' |
|
|
|
} from 'react' |
|
|
|
|
|
|
|
|
|
|
|
import map from 'lodash/map' |
|
|
|
|
|
|
|
import sumBy from 'lodash/sumBy' |
|
|
|
import sumBy from 'lodash/sumBy' |
|
|
|
import filter from 'lodash/filter' |
|
|
|
import filter from 'lodash/filter' |
|
|
|
import without from 'lodash/without' |
|
|
|
import without from 'lodash/without' |
|
|
|
@ -54,12 +53,12 @@ export const useSubscriptions = (goTo: (step: Steps) => void) => { |
|
|
|
const resetSubscriptions = useCallback(() => { |
|
|
|
const resetSubscriptions = useCallback(() => { |
|
|
|
setSelectedPeriod(SubscriptionType.Month) |
|
|
|
setSelectedPeriod(SubscriptionType.Month) |
|
|
|
setSelectedSubscriptions([]) |
|
|
|
setSelectedSubscriptions([]) |
|
|
|
|
|
|
|
setSubscriptionsList([]) |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
const subscribeToMatches = (e: MouseEvent) => { |
|
|
|
const subscribeToMatches = (e: MouseEvent) => { |
|
|
|
e.stopPropagation() |
|
|
|
e.stopPropagation() |
|
|
|
const ids = map(selectedSubscriptions, ({ id }) => id) |
|
|
|
buyMatchSubscriptions(selectedSubscriptions) |
|
|
|
buyMatchSubscriptions(ids) |
|
|
|
|
|
|
|
.then(() => goTo(Steps.Success)) |
|
|
|
.then(() => goTo(Steps.Success)) |
|
|
|
.catch(() => goTo(Steps.Error)) |
|
|
|
.catch(() => goTo(Steps.Error)) |
|
|
|
} |
|
|
|
} |
|
|
|
|