Commit d4b81ff8 authored by Nikolai R Kristiansen's avatar Nikolai R Kristiansen

Proof: Prevent charge if no membershiptype

parent f65f29a0
Pipeline #532 failed with stage
in 1 minute and 20 seconds
......@@ -4,6 +4,14 @@ import {Button, Text as NBText} from "native-base";
import theme from "../../theme";
export default class Membership extends Component {
render() {
if (this.props.isFetchingUserData) {
return (
<View style={styles.card}>
<Spinner color="#f58220"/>
</View>
);
}
return (
<ScrollView>
<View style={styles.card}>
......
......@@ -62,7 +62,11 @@ class MembershipContainer extends Component {
onLogoutPress={this.onLogoutPress}
/>;
}
return <Membership onLoginPress={this.onLoginPress} onRegisterPress={this.onRegisterPress} />;
return <Membership
isFetchingUserData={this.props.isFetchingUserData}
onLoginPress={this.onLoginPress}
onRegisterPress={this.onRegisterPress}
/>;
}
}
......
......@@ -88,7 +88,7 @@ export default class Proof extends Component {
<Button
onPress={this.props.onChargePress}
full
disabled={this.props.isChargingMembership}
disabled={this.props.isChargingMembership || this.props.isLoadingMembershipType}
style={styles.purchaseButton}
>
<NBText>{`Kjøp medlemskap (${this.props.membershipPrice} NOK)`}</NBText>
......
......@@ -15,7 +15,6 @@ stripe.init({
class ProofContainer extends Component {
// TODO: Prevent charge if we do not have a default membership type
constructor(props) {
super(props);
this.state = {
......@@ -36,6 +35,7 @@ class ProofContainer extends Component {
{...this.state}
user={this.props.user}
isChargingMembership={this.props.isChargingMembership}
isLoadingMembershipType={this.props.data.loading}
chargeError={this.props.chargeError}
onChargePress={this.openStripe}
onLogoutPress={this.props.onLogoutPress}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment