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

Commit

Permalink
[MM-29557] [MM-29590] Update subscription when purchase modal closes (#…
Browse files Browse the repository at this point in the history
…6765)

* Trigger getCloudSubscription after closing modal to update banners throughout webapp

* Fix types
  • Loading branch information
nickmisasi committed Oct 13, 2020
1 parent 28a8b5b commit a0973be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit a0973be

Please sign in to comment.