Commit bf058ee3 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

set base url (4)

parent 9bb34387
export const BASE_URL_LOGIN = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/login';
export const BASE_URL_REGISTER = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/register';
export const BASE_URL_REGISTER_CONFIRM ='https://excelsocrm.ravintoladev.com/crm/v2/auth/register_confirm';
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_LOGIN = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/login';
// export const BASE_URL_REGISTER = 'https://excelsocrm.ravintoladev.com/crm/v2/auth/register';
// export const BASE_URL_REGISTER_CONFIRM ='https://excelsocrm.ravintoladev.com/crm/v2/auth/register_confirm';
// 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';
\ No newline at end of file
......@@ -3116,6 +3116,11 @@
"invariant": "^2.2.4"
}
},
"expo-network": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/expo-network/-/expo-network-2.0.0.tgz",
"integrity": "sha512-LgWu0CqWzSRYbtIK9egHDGEHG07QaZ51LVMENmIuuZ5w7qJAdrM6MXdOB5nJcfjj1npXxX3TMlR6VoYkUWYU/Q=="
},
"expo-permissions": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-8.0.0.tgz",
......
......@@ -28,6 +28,7 @@
"expo-image-picker": "~8.0.1",
"expo-localization": "~8.0.0",
"expo-location": "^8.0.0",
"expo-network": "^2.0.0",
"expo-permissions": "^8.0.0",
"i18n-js": "^3.5.1",
"moment": "^2.25.3",
......
......@@ -189,17 +189,6 @@ class Account extends React.Component {
}
}
handleSettings() {
if (this.state.clickSettings == 3) {
this.props.navigation.navigate('Setting')
this.setState({ clickSettings: 0 })
} else {
let new_count = this.state.clickSettings
this.setState({ clickSettings: new_count + 1 })
}
}
render() {
const navigation = this.props.navigation
return (
......@@ -404,14 +393,12 @@ class Account extends React.Component {
)
}
<View style={{ flex: 1, marginBottom:20,marginTop:25 }}>
<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 style={{ flex: 1, marginBottom: 20, marginTop: 25 }}>
{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>
)}
</View>
</ScrollView>
......
......@@ -226,6 +226,16 @@ class Auth extends React.Component {
<>
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="Setting" component={SettingUrl} options={{headerStyle: { backgroundColor: "#CFB368" },
headerBackTitleStyle: { color: 'white' },
headerTintColor: '#fff',
headerTitleAlign: 'center',
headerTitleStyle: {
fontFamily: 'Gotham-Black',
color: 'white',
fontSize: 20,
},
title: 'SETTING URL'}}/>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Profile" component={ProfilePage} options={{
headerStyle: { backgroundColor: '#CFB368' },
......
......@@ -90,7 +90,7 @@ class EmailConfirmation extends React.Component {
"email": this.props.email,
"confirmation_number": this.state.confirmation_number,
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/auth/register_confirm', paramater).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/register_confirm', paramater).then(res => {
this.setState({
spinner: false,
})
......@@ -173,7 +173,7 @@ class EmailConfirmation extends React.Component {
}
this.props.setPage(pageProps)
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/auth/register_resend_email', paramater).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/register_resend_email', paramater).then(res => {
this.setState({
spinner: false,
})
......@@ -312,7 +312,8 @@ const mapStateToProps = (state) => {
registration_id: state.registration_id,
pageEmailConfirmation: state.pageEmailConfirmation,
proses: state.proses,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL
}
}
......
......@@ -13,6 +13,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
import Toast from 'react-native-tiny-toast';
import CheckVersion from '../function/CheckVersion';
import i18n from 'i18n-js';
import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
class Login extends React.Component {
constructor(props) {
......@@ -29,16 +30,27 @@ class Login extends React.Component {
session_id: "",
language: 'id',
spinner: false,
clickSettings: 0,
})
}
componentDidMount() {
const { navigation } = this.props
console.log(this.props.navigation)
console.log(this.props.BASE_URL)
CheckVersion(navigation)
this._getDeviceInfo()
}
handleSettings() {
if (this.state.clickSettings == 3) {
this.props.navigation.navigate('Setting')
this.setState({ clickSettings: 0 })
} else {
let new_count = this.state.clickSettings
this.setState({ clickSettings: new_count + 1 })
}
}
_getDeviceInfo = async () => {
if (Constants.isDevice) {
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
......@@ -156,7 +168,7 @@ class Login extends React.Component {
"app_version": this.props.app_version,
}
// console.log(params)
Axios.post(BASE_URL_LOGIN, params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/login', params).then(res => {
const navigation = this.props.navigation
......@@ -204,7 +216,7 @@ class Login extends React.Component {
let prosesProps = {
proses: ''
}
this.props.setProses(prosesProps);
this.props.setLoginInfo(loginProps)
......@@ -244,10 +256,10 @@ class Login extends React.Component {
<ImageBackground source={require('../assets/images/loging-background.png')} style={{ width: '100%', height: '100%' }}>
<View style={styles.logo}>
<Image source={require('../assets/images/excelso-log.png')} style={styles.imageslogo}></Image>
<Image resizeMode="cover" source={require('../assets/images/excelso-log.png')} style={styles.imageslogo}></Image>
</View>
<View style={styles.v_form}>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, justifyContent: 'center' }} removeClippedSubviews={false} >
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, justifyContent: 'center' }} removeClippedSubviews={false} >
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>{i18n.t('email')}</Text>
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1, padding: 10, borderRadius: 10, textAlign: 'center', fontFamily: 'Gotham-Black', color: 'white', fontSize: 13, fontWeight: 'bold' }}
......@@ -287,10 +299,11 @@ class Login extends React.Component {
</View>
<View style={{ flex: 1, justifyContent: 'center', marginRight: 60, marginLeft: 60 }}>
<TouchableWithoutFeedback onPress={()=> this.handleSettings()}>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368', fontSize: 13, textAlign: 'center', marginBottom: 5 }}>
{i18n.t('policy')} <Text style={{ fontWeight: 'bold' }}>{i18n.t('privacy')}</Text>
{i18n.t('policy')} <Text style={{ fontWeight: 'bold' }}>{i18n.t('privacy')}</Text>
</Text>
</TouchableWithoutFeedback>
</View>
</View>
</ImageBackground>
......@@ -306,7 +319,7 @@ const styles = StyleSheet.create({
},
logo: {
flex: 2.5,
height: 50
height: 50,
},
imageslogo: {
height: 150,
......@@ -314,7 +327,7 @@ const styles = StyleSheet.create({
width: 150,
justifyContent: 'center',
alignSelf: 'center',
top: 50
top: 50,
},
v_form: {
flex: 3,
......@@ -384,7 +397,8 @@ const mapStateToProps = (state) => {
os_version: state.os_version,
os_name: state.os_name,
app_version: state.app_version,
language: state.language
language: state.language,
BASE_URL: state.BASE_URL
}
}
......
......@@ -56,6 +56,7 @@ class NewRegister extends React.Component {
componentDidMount() {
this.load_data();
console.log("INI YA : "+this.props.BASE_URL)
let date_list = []
for (let i = 1; i <= 31; i++) {
......@@ -81,7 +82,7 @@ class NewRegister extends React.Component {
}
load_data() {
return Axios.get(BASE_URL_GET_ENUM).then(res => {
return Axios.get(this.props.BASE_URL+'crm/v2/auth/register_get_enum').then(res => {
// console.log('ini res enum nya : ' + JSON.stringify(res));
const data_enum = res.data;
const list_gender = data_enum.gender
......@@ -208,7 +209,7 @@ class NewRegister extends React.Component {
}
// console.log(parameter);
Axios.post(BASE_URL_REGISTER, parameter).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/register', parameter).then(res => {
// console.log(res);
let registerProps = {
email: this.state.email,
......@@ -563,6 +564,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => {
return {
language: state.language,
BASE_URL: state.BASE_URL,
}
}
......
......@@ -18,6 +18,10 @@ class ResetPassword extends React.Component {
}
}
componentDidMount(){
console.log("INI BASE:"+ this.props.BASE_URL);
}
handleResetPassword() {
this.setState({
spinner: true,
......@@ -26,7 +30,7 @@ class ResetPassword extends React.Component {
'email': this.state.email
}
// console.log(this.state.email)
Axios.post(BASE_URL_RESET_PASSWORD, params).then(res => {
Axios.post(this.props.BASE_URL+'crm/v2/auth/forgot_password', params).then(res => {
if (res.status === 200) {
let resetProps = {
email: this.state.email
......@@ -54,7 +58,7 @@ class ResetPassword extends React.Component {
spinner: false,
})
let response = error.response.data;
Alert.alert(response.msg);
Alert.alert('',response.msg);
})
}
......@@ -101,12 +105,9 @@ class ResetPassword extends React.Component {
<Image resizeMode="contain" source={require('../assets/images/daun.png')} style={styles.logo}></Image>
</View>
<View style={{ flex: 1 }}>
</View>
</View>
<View style={{ flex: 0.5 }}>
</View>
</View>
</View>
......@@ -161,7 +162,8 @@ const mapStateToProps = (state) => {
return {
email: state.email,
language: state.language,
isSubmitResetPassword: state.isSubmitResetPassword
isSubmitResetPassword: state.isSubmitResetPassword,
BASE_URL: state.BASE_URL
}
}
......
......@@ -14,8 +14,6 @@ export default class Welcome extends React.Component {
componentDidMount() {
// console.log(this.props.language)
}
render() {
return (
......
......@@ -16,13 +16,21 @@ class setBaseUrl extends React.Component {
}
handleSetUrl() {
if (this.state.base_url == '') {
Alert.alert('', 'Url tidak boleh kosong!')
let setUrls = {
BASE_URL:'https://excelsocrm.ravintoladev.com/'
}
this.props.setUrlProps(setUrls);
Alert.alert('','Base Url di setting ke default');
this.props.navigation.goBack();
} else {
let setUrls = {
BASE_URL: this.state.base_url
}
this.props.setUrlProps(setUrls);
Alert.alert('Berhasil', 'berhasil set ke : ' + this.state.base_url)
Alert.alert('Berhasil','Berhasil set url')
this.props.navigation.goBack();
}
}
......@@ -34,9 +42,7 @@ class setBaseUrl extends React.Component {
<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={'https://excelsocrm.ravintoladev.com/'} />
autoCapitalize="none"/>
<TouchableOpacity onPress={()=> this.handleSetUrl()}>
<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>
......
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