Commit e1aaba3a authored by William Goszal's avatar William Goszal 🚴

buat user gak bisa klik tombol claim balance saat sudah diklik

parent 480476cb
......@@ -16,6 +16,7 @@ import session from '../function/session';
import requestParams from '../helper/requestParams';
import ActionType from '../redux/globalActionType';
import CustomIosStatusBar from './CustomIosStatusBar';
import Spinner from 'react-native-loading-spinner-overlay';
class Home extends React.Component {
......@@ -25,6 +26,7 @@ class Home extends React.Component {
super(props);
this.state = {
spinner: false,
data_baner: [],
images: [],
point: "",
......@@ -47,7 +49,10 @@ class Home extends React.Component {
}
componentDidMount() {
this.loadAll()
}
loadAll(){
this.CheckInbox()
const screenWidth = Math.round(Dimensions.get('window').width);
......@@ -186,6 +191,7 @@ class Home extends React.Component {
let params = Object.assign(requestParams, {
session_id: this.props.session_id,
})
this.setState({indicatorProfileCard: true})
Axios.post(this.props.BASE_URL + 'crm/v2/member/get_profile', params).then(res => {
const dataCard = res.data
......@@ -296,10 +302,14 @@ class Home extends React.Component {
let params = Object.assign(requestParams, {
session_id: this.props.session_id,
})
Axios.post(this.props.BASE_URL + 'crm/v2/card/claim_old_balance', params).then(res => {
this.setState({spinner: false})
this._account()
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
this.componentDidMount()
}).catch(error => {
this.setState({spinner: false})
this._account()
let response = error.response.data
Alert.alert(error, response.msg)
})
......@@ -316,7 +326,12 @@ class Home extends React.Component {
style: 'cancel',
},
{
text: i18n.t('alertyes'), onPress: () => this.handleClaimCredit()
text: i18n.t('alertyes'), onPress: () => {
this.setState({spinner: true})
this.setState({old_balance_claimed: true}) /** set jadi true dulu buat hilangkan bagian claim credit */
this.setState({indicatorProfileCard: true}) /** atau sekalian dibuat loading aja bagian profilecardnya */
this.handleClaimCredit()
}
},
],
{ cancelable: false },
......@@ -333,6 +348,8 @@ class Home extends React.Component {
return (
<View style={styles.container}>
<Spinner visible={this.state.spinner} textContent={'Loading...'} textStyle={{ color: "white" }} />
{Platform.OS === 'ios' ? (
<CustomIosStatusBar color='#CFB368' />
) : (
......@@ -481,6 +498,7 @@ class Home extends React.Component {
</Card>
)
}
{
this.state.indicatorProfileCard == true ? (
<View style={styles.card}>
......@@ -489,6 +507,7 @@ class Home extends React.Component {
</Card>
</View>
) :
//jika member belum punya account kaspro
this.state.account_number == "" ? (
<View style={styles.card}>
......
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