Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[MM-29557] [MM-29590] Update subscription when purchase modal closes #6765

Merged
merged 2 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/purchase_modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Stripe} from '@stripe/stripe-js';

import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {GenericAction, ActionFunc} from 'mattermost-redux/types/actions';
import {getCloudProducts} from 'mattermost-redux/actions/cloud';
import {getCloudProducts, getCloudSubscription} from 'mattermost-redux/actions/cloud';
import {getClientConfig} from 'mattermost-redux/actions/general';

import {GlobalState} from 'types/store';
Expand Down Expand Up @@ -37,6 +37,7 @@ type Actions = {
getCloudProducts: () => void;
completeStripeAddPaymentMethod: (stripe: Stripe, billingDetails: BillingDetails, isDevMode: boolean) => Promise<boolean | null>;
getClientConfig: () => void;
getCloudSubscription: () => void;
}

function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
Expand All @@ -47,6 +48,7 @@ function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
getCloudProducts,
completeStripeAddPaymentMethod,
getClientConfig,
getCloudSubscription,
},
dispatch,
),
Expand Down
6 changes: 5 additions & 1 deletion components/purchase_modal/purchase_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Props = {
getCloudProducts: () => void;
completeStripeAddPaymentMethod: (stripe: Stripe, billingDetails: BillingDetails, isDevMode: boolean) => Promise<boolean | null>;
getClientConfig: () => void;
getCloudSubscription: () => void;
};
}

Expand Down Expand Up @@ -250,7 +251,10 @@ export default class PurchaseModal extends React.PureComponent<Props, State> {
this.props.actions.completeStripeAddPaymentMethod
}
isDevMode={this.props.isDevMode}
onClose={this.props.actions.closeModal}
onClose={() => {
this.props.actions.getCloudSubscription();
this.props.actions.closeModal();
}}
onBack={() => {
this.setState({processing: false});
}}
Expand Down