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