remove sign to auth fix invalid token
This commit is contained in:
parent
bd69442a83
commit
987cd4489f
|
@ -71,6 +71,7 @@ class ExpoBare extends React.Component<any, any> {
|
||||||
await AsyncStorage.removeItem('userInfo')
|
await AsyncStorage.removeItem('userInfo')
|
||||||
await AsyncStorage.removeItem('profileInfo')
|
await AsyncStorage.removeItem('profileInfo')
|
||||||
// this.props.navigation.navigate('signin')
|
// this.props.navigation.navigate('signin')
|
||||||
|
this.navigationRef.current.navigate('auth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +247,6 @@ class ExpoBare extends React.Component<any, any> {
|
||||||
const currentScreen = this.getActiveRouteName(currentState)
|
const currentScreen = this.getActiveRouteName(currentState)
|
||||||
const prevScreen = this.getActiveRouteName(prevState)
|
const prevScreen = this.getActiveRouteName(prevState)
|
||||||
if (prevScreen !== currentScreen) {
|
if (prevScreen !== currentScreen) {
|
||||||
console.log(currentScreen)
|
|
||||||
Analytics.logEvent(currentScreen)
|
Analytics.logEvent(currentScreen)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,6 @@ const defaultState = {
|
||||||
|
|
||||||
export const license = (state = defaultState, action: any) => {
|
export const license = (state = defaultState, action: any) => {
|
||||||
const response = action.data
|
const response = action.data
|
||||||
console.log(action.type)
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GET_LICENSE_VALIDATE:
|
case GET_LICENSE_VALIDATE:
|
||||||
case GET_MENU_LIST:
|
case GET_MENU_LIST:
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { connect } from "react-redux"
|
||||||
import { ActionCreators } from "@actions" //NOSONAR
|
import { ActionCreators } from "@actions" //NOSONAR
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { CommonActions } from "@react-navigation/native"
|
import { CommonActions } from "@react-navigation/native"
|
||||||
|
import { common } from '@constants/Constants' //NOSONAR
|
||||||
|
|
||||||
class Settings extends React.Component<any, any>{
|
class Settings extends React.Component<any, any>{
|
||||||
static propTypes = {};
|
static propTypes = {};
|
||||||
|
@ -22,7 +23,8 @@ class Settings extends React.Component<any, any>{
|
||||||
this.token = await AsyncStorage.getItem('token')
|
this.token = await AsyncStorage.getItem('token')
|
||||||
|
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
this.props.navigation.navigate('signin')
|
//this.props.navigation.navigate('signin')
|
||||||
|
this.props.navigation.navigate('auth')
|
||||||
}
|
}
|
||||||
|
|
||||||
await Analytics.setCurrentScreen('SettingsScreen')
|
await Analytics.setCurrentScreen('SettingsScreen')
|
||||||
|
@ -37,7 +39,11 @@ class Settings extends React.Component<any, any>{
|
||||||
if (this.props.info.hasOwnProperty('status')) {
|
if (this.props.info.hasOwnProperty('status')) {
|
||||||
if (this.props.info.status && !this.props.isLoggedIn) {
|
if (this.props.info.status && !this.props.isLoggedIn) {
|
||||||
this.logoutUser()
|
this.logoutUser()
|
||||||
|
}else if(this.props.info.hasOwnProperty('message') && this.props.info.message === common.invalidToken){
|
||||||
|
this.logoutUser()
|
||||||
}
|
}
|
||||||
|
}else if(this.props.info.hasOwnProperty('message') && this.props.info.message === common.invalidToken){
|
||||||
|
this.logoutUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +67,8 @@ class Settings extends React.Component<any, any>{
|
||||||
await AsyncStorage.removeItem('token')
|
await AsyncStorage.removeItem('token')
|
||||||
await AsyncStorage.removeItem('userInfo')
|
await AsyncStorage.removeItem('userInfo')
|
||||||
await AsyncStorage.removeItem('profileInfo')
|
await AsyncStorage.removeItem('profileInfo')
|
||||||
this.props.initLogin()
|
this.props.initLogin({})
|
||||||
|
this.props.initUserProfile({})
|
||||||
this.props.navigation.dispatch(
|
this.props.navigation.dispatch(
|
||||||
CommonActions.reset({
|
CommonActions.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
|
@ -134,6 +141,9 @@ const mapDispatchToProps = (dispatch: any) => ({
|
||||||
initLogin: (user: any) => {
|
initLogin: (user: any) => {
|
||||||
dispatch(ActionCreators.initLoginAction({}))
|
dispatch(ActionCreators.initLoginAction({}))
|
||||||
},
|
},
|
||||||
|
initUserProfile: (user: any) => {
|
||||||
|
dispatch(ActionCreators.initUserProfile(user))
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
Settings.propTypes = {
|
Settings.propTypes = {
|
||||||
|
|
|
@ -50,7 +50,8 @@ class TeacherAttendance extends React.Component<any, any>{
|
||||||
this.getMyCurrentLocation()
|
this.getMyCurrentLocation()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.props.navigation.navigate('signin')
|
//this.props.navigation.navigate('signin')
|
||||||
|
this.props.navigation.navigate('auth')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -316,21 +316,29 @@ class SchoolUpdate extends React.Component<any, any>{
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
handleConfirm = (selectedDate:any,setFieldValue: any, startTimeValue: any) => {
|
handleConfirm = (selectedDate:any,setFieldValue: any, timeValue: any, key:any) => {
|
||||||
this.setState({ startTimeShown: false })
|
if(key == 'start_time'){
|
||||||
let startTime: any = startTimeValue
|
let startTime: any = timeValue
|
||||||
if (selectedDate) {
|
if (selectedDate) {
|
||||||
startTime = moment(selectedDate).format("hh:mm A")
|
startTime = moment(selectedDate).format("hh:mm A")
|
||||||
}
|
}
|
||||||
this.setState({ start_time: { value: this.state.start_time.value } })
|
this.setState({ start_time: { value: this.state.start_time.value },startTimeShown: false })
|
||||||
setFieldValue('start_time', startTime)
|
setFieldValue('start_time', startTime)
|
||||||
|
}else{
|
||||||
};
|
let time: any = timeValue
|
||||||
|
if (selectedDate) {
|
||||||
hideDatePicker = () => {
|
time = moment(selectedDate).format("hh:mm A")
|
||||||
this.setState({ startTimeShown: false })
|
}
|
||||||
};
|
this.setState({ end_time: { value: this.state.end_time.value },endTimeShown: false })
|
||||||
|
setFieldValue('end_time', time)
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
hideDatePicker = () => {
|
||||||
|
this.setState({ startTimeShown: false, endTimeShown:false})
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
let schoolInfo: any = {}
|
let schoolInfo: any = {}
|
||||||
|
@ -340,8 +348,6 @@ class SchoolUpdate extends React.Component<any, any>{
|
||||||
schoolInfo = this.props.info.data
|
schoolInfo = this.props.info.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("SCL")
|
|
||||||
console.log(schoolInfo)
|
|
||||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||||
|
|
||||||
<Text style={BaseStyles.topHeader}>Update School Details</Text>
|
<Text style={BaseStyles.topHeader}>Update School Details</Text>
|
||||||
|
@ -461,7 +467,7 @@ class SchoolUpdate extends React.Component<any, any>{
|
||||||
{this.state.startTimeShown && <DateTimePickerModal
|
{this.state.startTimeShown && <DateTimePickerModal
|
||||||
isVisible={this.state.startTimeShown}
|
isVisible={this.state.startTimeShown}
|
||||||
mode="time"
|
mode="time"
|
||||||
onConfirm={(date)=>this.handleConfirm(date,setFieldValue,values.start_time)}
|
onConfirm={(date)=>this.handleConfirm(date,setFieldValue,values.start_time, 'start_time')}
|
||||||
onCancel={this.hideDatePicker}
|
onCancel={this.hideDatePicker}
|
||||||
date={this.state.start_time.value}
|
date={this.state.start_time.value}
|
||||||
/>
|
/>
|
||||||
|
@ -474,8 +480,22 @@ class SchoolUpdate extends React.Component<any, any>{
|
||||||
<Text style={styles.icon}
|
<Text style={styles.icon}
|
||||||
onPress={this.endTimePicker.bind(this, 'end_time', setFieldValue, values.end_time)}><Ionicons name={"time"} size={18} /></Text>
|
onPress={this.endTimePicker.bind(this, 'end_time', setFieldValue, values.end_time)}><Ionicons name={"time"} size={18} /></Text>
|
||||||
</View>
|
</View>
|
||||||
{this.state.endTimeShown && <RNDateTimePicker mode="time" display={"spinner"} timeZoneOffsetInMinutes={0} is24Hour={false}
|
{this.state.endTimeShown &&
|
||||||
onChange={this.onEndTimeChange.bind(this, 'end_time', setFieldValue, values.end_time)} value={this.state.end_time.value} />}
|
// <RNDateTimePicker mode="time"
|
||||||
|
// display={"spinner"}
|
||||||
|
// timeZoneOffsetInMinutes={0}
|
||||||
|
// is24Hour={false}
|
||||||
|
// onChange={this.onEndTimeChange.bind(this, 'end_time', setFieldValue, values.end_time)}
|
||||||
|
// value={this.state.end_time.value}
|
||||||
|
// />
|
||||||
|
<DateTimePickerModal
|
||||||
|
isVisible={this.state.endTimeShown}
|
||||||
|
mode="time"
|
||||||
|
onConfirm={(date)=>this.handleConfirm(date,setFieldValue,values.end_time, 'end_time')}
|
||||||
|
onCancel={this.hideDatePicker}
|
||||||
|
date={this.state.end_time.value}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{(errors.start_time && touched.start_time) && <Text style={AppStyles.error}>{errors.start_time}</Text>}
|
{(errors.start_time && touched.start_time) && <Text style={AppStyles.error}>{errors.start_time}</Text>}
|
||||||
|
|
Loading…
Reference in New Issue