Commit a4d4b682 authored by Trisno's avatar Trisno

session expired, pake toast

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