Commit 2b748105 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

set base url

parent 68b7aeb4
......@@ -4,24 +4,5 @@ export const BASE_URL_REGISTER_CONFIRM ='https://excelsocrm.ravintoladev.com/crm
export const BASE_URL_GET_ENUM = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/register_get_enum';
export const BASE_URL_GET_CARAOUSEL = 'https://excelsocrm.ravintoladev.com/cms/v2/list/promotions-carousel';
export const BASE_URL_RESET_PASSWORD = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/forgot_password';
export const BASE_URL_CHANGE_PASSWORD = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/change_password';
export const BASE_URL_NEW_PASSWORD = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/reset_password';
// =======
// export const BASE_URL_REGISTER = 'http://192.168.2.188:8000/crm/v2/auth/register';
// export const BASE_URL_REGISTER_CONFIRM ='http://192.168.2.188:8000/crm/v2/auth/register_confirm';
// export const BASE_URL_GET_ENUM = 'http://192.168.2.188:8000/crm/v2/auth/register_get_enum';
// export const BASE_URL_GET_CARAOUSEL = 'http://192.168.2.188:8000/cms/v2/list/promotions-carousel';
// export const BASE_URL_RESET_PASSWORD = 'http://192.168.2.188:8000/crm/v2/auth/forgot_password';
// export const BASE_URL_CHANGE_PASSWORD = 'http://192.168.2.188:8000/crm/v2/auth/change_password';
// // export const BASE_URL_NEW_PASSWORD = 'http://192.168.2.188:8000/crm/v2/auth/reset_password';
// >>>>>>> b5ca15bca6f7d685a79d0bf93fb703568fc68c60
// export const BASE_URL_LOGIN = 'https://192.168.2.187:8000/crm/v2/auth/login';
// export const BASE_URL_REGISTER = 'https://192.168.2.187:8000/crm/v2/auth/register';
// export const BASE_URL_REGISTER_CONFIRM ='https://192.168.2.187:8000/crm/v2/auth/register_confirm';
// export const BASE_URL_GET_ENUM = 'https://192.168.2.188:8000/crm/v2/auth/register_get_enum';
// export const BASE_URL_GET_CARAOUSEL = 'https://192.168.2.187:8000/cms/v2/list/promotions-carousel';
// export const BASE_URL_RESET_PASSWORD = 'https://192.168.2.187:8000/crm/v2/auth/forgot_password';
// export const BASE_URL_CHANGE_PASSWORD = 'https://192.168.2.187:8000/crm/v2/auth/change_password';
// export const BASE_URL_NEW_PASSWORD = 'https://192.168.2.187:8000/crm/v2/auth/reset_password';
\ No newline at end of file
// export const BASE_URL_CHANGE_PASSWORD = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/change_password';
export const BASE_URL_NEW_PASSWORD = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/reset_password';
\ No newline at end of file
......@@ -43,6 +43,7 @@ const ActionType = {
SET_REEDEM :'SET_REEDEM',
REMOVE_VOUCHER : 'REMOVE_VOUCHER',
SET_CHANGE_RESET_PASSWORD : 'SET_CHANGE_RESET_PASSWORD',
//set url
SET_BASE_URL :'SET_BASE_URL'
}
......
......@@ -89,6 +89,7 @@ const globalState = {
outlet_detailadress: '',
isSubmitResetPassword: false,
BASE_URL:'https://excelsocrm.ravintoladev.com/'
}
......
......@@ -44,7 +44,8 @@ class Account extends React.Component {
my_lat: 0,
my_long: 0,
full_name: '',
indicator: true
indicator: true,
clickSettings: 0,
}
}
......@@ -111,7 +112,7 @@ class Account extends React.Component {
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
const dataCard = res.data
let email = dataCard.email
let point = dataCard.kaspro_point
......@@ -190,11 +191,11 @@ class Account extends React.Component {
handleSettings() {
if (this.state.clickSettings == 8) {
this.props.navigation.navigate('SettingsScreen')
if (this.state.clickSettings == 1) {
this.props.navigation.navigate('Setting')
this.setState({ clickSettings: 0 })
} else {
new_count = this.state.clickSettings
let new_count = this.state.clickSettings
this.setState({ clickSettings: new_count + 1 })
}
}
......@@ -405,11 +406,13 @@ class Account extends React.Component {
}
<View style={{ flex: 1, marginBottom: 10 }}>
<TouchableOpacity onPress={()=> this.handleSettings()}>
{Platform.OS === 'ios' ? (
<Text style={{ color: 'grey', fontSize: 12, textAlign: 'center' }}>Version {Constants.manifest.version} Build {Constants.manifest.ios.buildNumber}</Text>
) : (
<Text style={{ color: 'grey', fontSize: 12, textAlign: 'center' }}>Version {Constants.manifest.version} Build {Constants.manifest.android.versionCode}</Text>
)}
</TouchableOpacity>
</View>
</ScrollView>
......@@ -530,6 +533,7 @@ const mapStateToProps = (state) => {
set_card: state.set_card,
in_payment: state.in_payment,
language: state.language,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -11,6 +11,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
import { MaterialCommunityIcons, Ionicons } from '@expo/vector-icons';
import ActionType from '../redux/globalActionType';
import i18n from 'i18n-js';
import session from '../function/session';
class AddreesDetail extends React.Component {
......@@ -126,7 +127,7 @@ class AddreesDetail extends React.Component {
}
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/set_address', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/set_address', params).then(res => {
Alert.alert(
'Berhasil',
'Berhasil menambahkan Alamat !'
......@@ -222,21 +223,18 @@ class AddreesDetail extends React.Component {
<Text style={{ fontFamily: 'Gotham-Light', textAlign: 'center' }}>{this.state.postalCode}</Text>
</View>
)}
<View style={{ flex: 1 }}>
</View>
</View>
<View style={styles.field_name_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", textAlign: 'center', fontSize: 18 }}>{i18n.t('label')}</Text>
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }} onChangeText={(name) => this.setState({ name })} />
<TextInput style={{ color:'grey', fontFamily:'Gotham-Black', height: 40, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey',textAlign:'center' }} onChangeText={(name) => this.setState({ name })} />
</View>
<View style={styles.field_detail_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c",textAlign:'center', fontSize: 18 }}>{i18n.t('detail')}</Text>
<TextInput
style={{ height: 150, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }}
style={{color:'grey', fontFamily:'Gotham-Black', textAlign:'center', height: 120, borderWidth: 1, padding: 5, flex: 1, margin: 10, borderRadius: 10, borderColor: 'grey' }}
onChangeText={(description) => this.setState({ description })}
numberOfLines={10}
multiline={true} />
......@@ -248,7 +246,7 @@ class AddreesDetail extends React.Component {
</View>
</TouchableOpacity>
</View>
<View style={{ height: 80}}></View>
<View style={{ height: 20}}></View>
</View>
</View>
</ScrollView>
......@@ -301,7 +299,6 @@ const styles = StyleSheet.create({
},
field_detail_addrees: {
flexDirection: 'column',
top: 40,
},
......@@ -317,6 +314,8 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
language: state.language,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -56,6 +56,7 @@ import RatingOrder from './RatingOrder';
import UseBalance from './UseBalance';
import PaymentCode from './PaymentCode';
import UpdateVersion from './UpdateVersion';
import SettingUrl from './setBaseUrl';
enableScreens();
......@@ -381,6 +382,7 @@ class Auth extends React.Component {
}, title: 'RENEWAL'
}} />
<Stack.Screen name="Account" component={Account} />
<Stack.Screen name="Setting" component={SettingUrl}/>
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="Transfer Balance" component={TransferBalance} options={{
headerStyle: { backgroundColor: "#CFB368" },
......
......@@ -28,7 +28,7 @@ class ChangePassword extends React.Component {
"password": this.state.Password,
"password_confirmation": this.state.Password_confirmation
}
Axios.post(BASE_URL_CHANGE_PASSWORD, params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/change_password', params).then(res => {
this.props.navigation.navigate('Profile');
}).catch(error => {
console.log(error)
......@@ -159,7 +159,8 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language
language: state.language,
BASE_URL : state.BASE_URL
}
}
......
......@@ -41,7 +41,7 @@ class DeliveryAddrees extends React.Component {
}
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_address', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_address', params).then(res => {
const dataAlamat = res.data.data;
console.log("INI DATA :" + JSON.stringify(dataAlamat))
let address = []
......@@ -82,7 +82,7 @@ class DeliveryAddrees extends React.Component {
// console.log("INI PRAMETER NYA : " + JSON.stringify(params))
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => {
// this.setState({
// grabamount: res.data.data.amount,
......@@ -162,7 +162,7 @@ class DeliveryAddrees extends React.Component {
address_id: id,
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => {
let setGrabProps = {
// grabdestination: this.state.grabdestination,
......@@ -291,8 +291,6 @@ class DeliveryAddrees extends React.Component {
keyExtractor={item => item.id}
/>
)}
</View>
</ScrollView>
</View>
......@@ -343,7 +341,8 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
addressId: state.addressId,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL
}
}
......@@ -397,57 +396,4 @@ const mapDispatchToProps = (dispacth) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(DeliveryAddrees)
{/* <TouchableOpacity onPress={() => this.onSave(item.address, item.id)}>
<View style={{ margin: 5, }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text>
</View>
<Text style={{ margin: 5 }}>
{item.address}
</Text>
</TouchableOpacity> */}
// <View style={styles.searchBar}>
// <View style={{ height: 50, borderWidth: 1, borderColor: 'black', borderRadius: 15, margin: 15, flexDirection: 'row' }}>
// <View style={{ flex: 1 }}>
// </View>
// <View style={{ flex: 4 }}></View>
// <View style={{ flex: 1 }}></View>
// </View>
// </View>
// <View style={styles.btnAddress}>
// <TouchableOpacity onPress={() => this.addAdreess()}>
// <View style={{ height: 40, borderRadius: 15, marginRight: 70, marginLeft: 70, backgroundColor: '#CFB368', justifyContent: 'center', alignContent: 'center' }}>
// <Text style={{ fontFamily: 'Gotham-Black', textAlign: 'center', color: 'white', fontSize: 20 }}> + Tambah Alamat </Text>
// </View>
// </TouchableOpacity>
// </View>
// <View style={styles.listAddress}>
// <FlatList
// data={this.state.data}
// renderItem={this.renderItem}
// keyExtractor={item => item.id}
// />
// </View>
// <View style={styles.body}>
// {/* <ScrollView> */}
// <View style={styles.btn_addreess}>
// <Button title="Tambah Alamat" onPress={() => this.addAdreess()}></Button>
// </View>
// <FlatList
// data={this.state.data}
// renderItem={this.renderItem}
// keyExtractor={item => item.id}
// />
// </View>
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(DeliveryAddrees)
\ No newline at end of file
......@@ -39,9 +39,7 @@ class Home extends React.Component {
}
componentDidMount() {
// const { navigation } = this.props
// CheckVersion(navigation)
console.log("INI BASE_URL : " + this.props.BASE_URL)
const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({
slider_height: screenWidth
......@@ -118,7 +116,7 @@ class Home extends React.Component {
this._getOutletClosest();
}
_renderCarousell() {
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/list/promotions-carousel').then(respon => {
Axios.get(this.props.BASE_URL+'cms/v2/list/promotions-carousel').then(respon => {
const dataCarousell = respon.data.contents;
let imageLink = []
let slugs = []
......@@ -146,7 +144,7 @@ class Home extends React.Component {
session_id: this.props.session_id,
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
const dataCard = res.data
let point = dataCard.kaspro_point
......@@ -175,7 +173,7 @@ class Home extends React.Component {
long: this.state.my_long
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_closest', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/outlet/get_closest', params).then(res => {
// console.log(res.data.data)
let outletId = res.data.data.outlet_id
......@@ -663,7 +661,6 @@ const mapDispatchToProps = (dispacth) => {
const mapStateToProps = (state) => {
return {
// login
in_payment: state.in_payment,
BASE_URL: state.BASE_URL,
......
......@@ -100,7 +100,7 @@ class MenuSelection extends React.Component {
long: this.state.my_long
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_closest', params).then((res) => {
Axios.post(this.props.BASE_URL+'crm/v2/outlet/get_closest', params).then((res) => {
let outletId = res.data.data.outlet_id
......@@ -126,7 +126,7 @@ class MenuSelection extends React.Component {
outlet_id: this.props.outlet_id
}
// console.log("INI YA " + params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/menu/get_list', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/menu/get_list', params).then(res => {
let data = res.data.data
// console.log("INI DATANYA" + JSON.stringify(data))
......@@ -382,6 +382,7 @@ const mapStateToProps = (state) => {
return {
type_pickup: state.type_pickup,
BASE_URL: state.BASE_URL,
session_id: state.session_id,
grabamount: state.grabamount,
outlet_id: state.outlet_id,
......@@ -430,25 +431,3 @@ const mapDispatchToProps = (dispacth) => {
export default connect(mapStateToProps, mapDispatchToProps)(MenuSelection)
{/* <Button title="VIEW CART" onPress={() => this.props.navigation.navigate('Shopping Cart')}></Button> */ }
// {
// this.state.indicator == true ? (<ActivityIndicator style={{ top: 10 }} size="large" color="#c9af6d" />) : (
// <View style={{ flexDirection: 'row', }}>
// <Text style={{ fontSize: 12, margin: 10, fontFamily:'Gotham-Black' }}> {this.props.order_quantity} Item | {this.props.type_pickup == true ? (null) : (
// <Text style={{ fontSize: 12, margin: 10 }}> Ongkir {this.props.grabamount} </Text>
// )} </Text>
// <Text style={{ fontSize: 20, margin: 10, marginBottom: 10 }}> Rp. {this.props.order_total}</Text>
// </View>
// )
// }
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', textAlign: 'center',top:10,marginLeft:45 }}> {this.props.order_quantity} Item | {this.props.type_pickup == true ? (null) : (
<Text style={{ fontSize: 12 }}> Ongkir {this.props.grabamount} </Text>
)} </Text>
<NumberFormat decimalScale={0} value={this.props.order_total} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> */}
......@@ -39,6 +39,8 @@ class OrderDetail extends React.Component {
componentDidMount() {
// console.log("INI URL NYA : " + this.props.BASE_URL )
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
this.getDetailTrans()
......@@ -89,7 +91,7 @@ class OrderDetail extends React.Component {
reason: "Cancelled By User"
}
// console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/cancel', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/transaction/cancel', params).then(res => {
let respon = res.data.status
Alert.alert(respon, 'Order was canceled')
this.props.navigation.navigate('Home', { screen: 'ORDER' });
......@@ -109,9 +111,9 @@ class OrderDetail extends React.Component {
transaction_id: this.props.route.params.idTrans
}
// console.log("PARAMETER : " + JSON.stringify(params))
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/transaction/detail', params).then(res => {
let data = res.data
console.log(data)
// console.log(data)
if (data.trans_status_display == 'On Queue') {
data.trans_status_display = 'Queueing'
} else
......@@ -653,6 +655,7 @@ const mapStateToProps = (state) => {
trans_id: state.trans_id,
lat: state.lat,
long: state.long,
BASE_URL : state.BASE_URL
}
}
......
......@@ -43,7 +43,7 @@ class OrderHistory extends React.Component {
let params = {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/list', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/transaction/list', params).then(res => {
let data = res.data.data
// console.log(data)
data.map((item) => {
......@@ -152,7 +152,8 @@ const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -96,7 +96,7 @@ class Outlets extends React.Component {
session_id: this.props.session_id
}
Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => {
Axios.post(this.props.BASE_URL+"crm/v2/outlet/get_list", params).then(res => {
let dataOutlets = res.data.outlets;
for (let i = 0; i < dataOutlets.length; i++) {
dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']);
......@@ -147,7 +147,7 @@ class Outlets extends React.Component {
}
OrderedList() {
Axios.get("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_city_list").then(res => {
Axios.get(this.props.BASE_URL+'crm/v2/outlet/get_city_list').then(res => {
let cities = res.data.city
let data_city = []
......@@ -175,31 +175,6 @@ class Outlets extends React.Component {
})
}
// _getOutletClosest() {
// let params = {
// session_id: this.props.session_id,
// lat: this.props.lat,
// long: this.props.long
// }
// // console.log(params);
// Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_closest', params).then(res => {
// let outletName = res.data.data.outlet_name
// this.setState({
// // indicator: false,
// data_name: outletName
// })
// // console.log("INI ADALAH RESPON : + " + JSON.stringify(res))
// // console.log("INI DATANYA NAME : " + outletName)
// }).catch(error => {
// const { navigation } = this.props
// let response = error.response.data
// session(response, navigation)
// Alert.alert(response.msg);
// })
// }
toRad(value) {
return value * Math.PI / 180;
......@@ -389,26 +364,8 @@ const mapStateToProps = (state) => {
name_outlet: state.name_outlet,
lat: state.lat,
long: state.long,
BASE_URL: state.BASE_URL,
}
}
export default connect(mapStateToProps)(Outlets);
{/* <View style={{flex:1,backgroundColor:'red'}}>
</View>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text>
<Text style={{ fontWeight: 'bold', fontSize: 15, color: '#ccb46c' }}>OPEN - </Text>
</View>
<Text style={{ margin: 5, color: '#b1b1b2' }}>
{item.full_address}
</Text>
<Text style={{ margin: 5, color: '#aeaead' }}>
{item.distance} KM
</Text>
</View>
</View> */}
\ No newline at end of file
export default connect(mapStateToProps)(Outlets);
\ No newline at end of file
......@@ -34,7 +34,7 @@ class ProfilePage extends PureComponent {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
let data = res.data
console.log("INI DATANYA : " + JSON.stringify(data));
......@@ -197,6 +197,7 @@ const mapStateToProps = (state) => {
language: state.language,
full_name: state.full_name,
gender_display: state.gender_display,
BASE_URL: state.BASE_URL
}
}
......
......@@ -19,15 +19,15 @@ class Renewal extends React.Component {
componentDidMount() {
this._getProfile();
// console.log(this.props.BASE_URL)
}
_renewal() {
let params = {
session_id: this.props.session_id
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/renewal', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/card/renewal', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
this._getProfile();
this.props.navigation.navigate('HOME',{screen:'Account'});
......@@ -43,7 +43,7 @@ class Renewal extends React.Component {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
const dataCard = res.data
......@@ -57,7 +57,6 @@ class Renewal extends React.Component {
date.setFullYear(date.getFullYear() + 1);
let date_nextyear_string = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate()
console.log("INI YA : " + date_nextyear_string)
this.setState({
current_balance: balance,
......@@ -171,7 +170,8 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL
}
}
export default connect(mapStateToProps)(Renewal);
......@@ -45,7 +45,7 @@ class RewardDetail extends React.Component {
session_id: this.props.session_id,
reward_id: this.props.route.params.rewardId
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/reward/get_detail', params).then(res => {
let expire_date = moment(res.data.reward.expire_time).format('DD MMMM YYYY')
......@@ -272,6 +272,7 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
lat: state.lat,
long: state.long,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -16,6 +16,7 @@ class RewardSelect extends React.Component {
}
componentDidMount() {
console.log(this.props.BASE_URL);
this.getRewardsList()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.getRewardsList()
......@@ -156,7 +157,7 @@ const mapStateToProps = (state) => {
session_id: state.session_id,
value_voucher: state.value_voucher,
voucher: state.voucher,
BASE_URL: state.BASE_URL
}
}
......
......@@ -16,6 +16,7 @@ class RewardsList extends React.Component {
}
componentDidMount() {
// console.log("INI YA REWARD URL :"+this.props.BASE_URL)
this.getRewardsList()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
......@@ -34,7 +35,7 @@ class RewardsList extends React.Component {
let params = {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/reward/get_list', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/reward/get_list', params).then(res => {
let data = res.data.rewards
// console.log(data)
data.map((item, key) => {
......@@ -129,7 +130,8 @@ const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -6,9 +6,10 @@ import HTML from 'react-native-render-html';
import { Collapse, CollapseHeader, CollapseBody, AccordionList } from 'accordion-collapse-react-native'
import { getStatusBarHeight } from 'react-native-status-bar-height';
import MyStatusBar from './MyStatusBar';
import { connect } from 'react-redux';
export default class TopUpInfo extends React.Component {
class TopUpInfo extends React.Component {
constructor(props) {
super(props);
this.state = {
......@@ -18,11 +19,12 @@ export default class TopUpInfo extends React.Component {
}
componentDidMount() {
console.log("ii" + this.props.BASE_URL)
const statusBarHeight = getStatusBarHeight();
this.setState({
statusbar_height: statusBarHeight
})
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/list/topup-info').then(res => {
Axios.get(this.props.BASE_URL+'cms/v2/list/topup-info').then(res => {
let data = res.data;
this.setState({
topup_info: data.contents
......@@ -123,4 +125,13 @@ const styles = StyleSheet.create({
height: 28,
alignItems: 'flex-end'
}
})
\ No newline at end of file
})
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language,
BASE_URL: state.BASE_URL
}
}
export default connect(mapStateToProps)(TopUpInfo);
\ No newline at end of file
......@@ -38,7 +38,7 @@ class TransactionHistory extends React.Component {
let params = {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/history', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/transaction/history', params).then(res => {
let data = res.data.transactions
console.log(data)
data.map((item) => {
......@@ -208,16 +208,6 @@ class TransactionHistory extends React.Component {
</View>
</View>
)
))
))
) : (
......@@ -255,9 +245,9 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
BASE_URL: state.BASE_URL
}
}
......
......@@ -24,13 +24,14 @@ class TransferBalance extends React.Component {
componentDidMount() {
this.getBalance()
console.log(this.props.BASE_URL);
}
getBalance() {
let params = {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
let data = res.data
// console.log('ini res nya : ' + data.kaspro_balance)
this.setState({
......@@ -57,7 +58,7 @@ class TransferBalance extends React.Component {
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/transfer', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/card/transfer', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
Alert.alert('Transaksi Berhasil')
this.props.navigation.goBack()
......@@ -182,7 +183,8 @@ const mapStateToProps = (state) => {
return {
session_id: state.session_id,
set_card: state.set_card,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL
}
}
......
......@@ -43,7 +43,7 @@ class UseBalance extends React.Component {
session_id: this.props.session_id
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
const dataCard = res.data
......@@ -135,7 +135,7 @@ class UseBalance extends React.Component {
}
console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/point/redeem', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/point/redeem', params).then(res => {
// console.log(res.data)
let respon = res.data
// Alert.alert('', 'Sukses Redeem')
......@@ -174,7 +174,7 @@ class UseBalance extends React.Component {
}
console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/point/redeem', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/point/redeem', params).then(res => {
// console.log(res.data)
let respon = res.data
console.log("INI DATANYA " + respon)
......@@ -215,7 +215,7 @@ class UseBalance extends React.Component {
}
console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/point/redeem', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/point/redeem', params).then(res => {
let respon = res.data
console.log("INI DATANYA " + respon)
// Alert.alert('', 'Sukses Redeem')
......@@ -250,7 +250,7 @@ class UseBalance extends React.Component {
}
console.log(params)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/point/redeem', params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/point/redeem', params).then(res => {
let respon = res.data
console.log("INI DATANYA " + respon)
// Alert.alert('', 'Sukses Redeem')
......@@ -558,7 +558,8 @@ const mapStateToProps = (state) => {
return {
session_id: state.session_id,
language: state.language,
pageEmailConfirmation: state.pageEmailConfirmation
pageEmailConfirmation: state.pageEmailConfirmation,
BASE_URL: state.BASE_URL
}
}
......
import { Text, TouchableOpacity, View, StyleSheet, TextInput, Alert } from 'react-native';
import React from 'react';
import ActionType from '../redux/globalActionType';
import { connect } from 'react-redux';
class setBaseUrl extends React.Component {
constructor(props) {
super(props);
this.state = {
base_url: "",
}
}
componentDidMount() {
console.log("INI YAAA: " + this.props.BASE_URL)
}
handleSetUrl() {
if (this.state.base_url == '') {
Alert.alert('','Url tidak boleh kosong!')
} else {
let setUrls = {
BASE_URL: this.state.base_url
}
this.props.setUrlProps(setUrls);
Alert.alert('Berhasil','berhasil set ke : ' + this.props.BASE_URL)
}
}
render() {
return (
<View style={{ flex: 1, backgroundColor: 'white' }}>
<View style={{ flex: 3 }}>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, top: 60 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>URL</Text>
<TextInput style={{ height: 40, borderWidth: 1, padding: 5, margin: 5, borderRadius: 10, borderColor: 'grey', fontFamily: 'Gotham-Black', textAlign: 'center', color: 'grey', fontWeight: 'bold', fontSize: 12 }}
onChangeText={(base_url) => this.setState({ base_url })}
value={this.state.base_url}
autoCapitalize="none"
placeholder={this.props.BASE_URL} />
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368',marginTop:20,justifyContent:'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center' }}>CHANGE URL </Text>
</View>
</View>
</View>
</View>
)
}
}
const mapStateToProps = (state) => {
return {
BASE_URL: state.BASE_URL
}
}
const mapDispatchToProps = (dispacth) => {
return {
setUrlProps: (setUrls) => dispacth({
type: ActionType.SET_BASE_URL,
data: {
BASE_URL: setUrls.BASE_URL
}
}),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(setBaseUrl)
\ No newline at end of file
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