Commit a4d4b682 authored by Trisno's avatar Trisno

session expired, pake toast

parent c9f770eb
......@@ -9,7 +9,8 @@ import {
TouchableOpacity,
Alert,
Button,
ImageBackground
ImageBackground,
ToastAndroid
} from 'react-native';
import { StackActions } from '@react-navigation/native';
......@@ -147,9 +148,12 @@ class Account extends React.Component {
})
}).catch(error => {
const { navigation } = this.props
// const { navigation } = this.props
// let response = error.response.data
// session(response, navigation)
let response = error.response.data
session(response, navigation)
// Alert.alert('',response.msg);
ToastAndroid.show(response.msg, ToastAndroid.SHORT)
})
}
......@@ -347,9 +351,9 @@ class Account extends React.Component {
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}>
{this.state.premium === false ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Upgrade Premium')} style={{ marginBottom: 20, marginRight: 5, marginLeft: 5 }}>
<Card style={{ width: 200, paddingHorizontal:10, paddingTop:20, paddingBottom:20 }}>
<View style={{ flex:1, alignItems: 'center' }}>
<MaterialIcons name="autorenew" size={30} color="gray" style={{ marginBottom: 10 }} />
<Card style={{ width: 200, paddingHorizontal: 10, paddingTop: 20, paddingBottom: 20 }}>
<View style={{ flex: 1, alignItems: 'center' }}>
<MaterialIcons name="autorenew" size={30} color="gray" style={{ marginBottom: 10 }} />
<Text style={{ fontFamily: 'Gotham-Black', textAlign: 'center', fontSize: 14, color: '#838383' }}>UPGRADE PREMIUM</Text>
</View>
</Card>
......@@ -372,9 +376,9 @@ class Account extends React.Component {
)
}
<View style={{ flex: 1, marginBottom: 10 }}>
<Text style={{ color: 'grey', fontSize: 12, textAlign: 'center' }}>Build Version : {Constants.manifest.version}</Text>
</View>
<View style={{ flex: 1, marginBottom: 10 }}>
<Text style={{ color: 'grey', fontSize: 12, textAlign: 'center' }}>Build Version : {Constants.manifest.version}</Text>
</View>
</ScrollView>
</View>
......
......@@ -4,7 +4,7 @@ import * as Device from 'expo-device';
import * as Location from 'expo-location';
import * as Permissions from 'expo-permissions';
import * as React from 'react';
import { ActivityIndicator, Alert, Dimensions, ScrollView, StyleSheet, Text, TouchableOpacity, View, SafeAreaView, StatusBar } from 'react-native';
import { ActivityIndicator, Alert, Dimensions, ScrollView, StyleSheet, Text, TouchableOpacity, View, SafeAreaView, StatusBar, ToastAndroid } from 'react-native';
import { SliderBox } from "react-native-image-slider-box";
import { Card } from 'react-native-shadow-cards';
import { connect } from 'react-redux';
......@@ -35,6 +35,7 @@ class Home extends React.Component {
}
componentDidMount() {
const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({
slider_height: screenWidth
......@@ -61,10 +62,12 @@ class Home extends React.Component {
_getPermissions = async () => {
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
Alert.alert('Akses tidak dizinkan!')
// Alert.alert('Akses tidak dizinkan!')
ToastAndroid.show("Akses tidak dizinkan!", ToastAndroid.SHORT)
} else if (Platform.OS === 'android' && !Device.isDevice) {
Alert.alert('Silahkan anda coba di real Device')
// Alert.alert('Silahkan anda coba di real Device')
ToastAndroid.show("Silahkan anda coba di real Device", ToastAndroid.SHORT)
} else {
this._getCurrentPosisition()
}
......@@ -138,7 +141,8 @@ class Home extends React.Component {
})
}).catch(error => {
let response = error.response.data
Alert.alert('',response.msg);
// Alert.alert('',response.msg);
ToastAndroid.show(response.msg, ToastAndroid.SHORT)
})
}
......@@ -150,7 +154,7 @@ class Home extends React.Component {
}
// console.log(params);
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_closest', params).then(res => {
console.log(res.data.data)
// console.log(res.data.data)
let outletId = res.data.data.outlet_id
let outletName = res.data.data.outlet_name
......@@ -167,7 +171,8 @@ class Home extends React.Component {
})
}).catch(error => {
let response = error.response.data
Alert.alert('',response.msg);
// Alert.alert('',response.msg);
ToastAndroid.show(response.msg, ToastAndroid.SHORT)
})
}
......@@ -197,7 +202,8 @@ class Home extends React.Component {
});
} else {
Alert.alert('Belum dapat outlet terdekat')
// Alert.alert('Belum dapat outlet terdekat')
ToastAndroid.show('Belum dapat outlet terdekat', ToastAndroid.SHORT)
}
}
......
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