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('profileInfo')
|
||||
// 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 prevScreen = this.getActiveRouteName(prevState)
|
||||
if (prevScreen !== currentScreen) {
|
||||
console.log(currentScreen)
|
||||
Analytics.logEvent(currentScreen)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,7 +18,6 @@ const defaultState = {
|
|||
|
||||
export const license = (state = defaultState, action: any) => {
|
||||
const response = action.data
|
||||
console.log(action.type)
|
||||
switch (action.type) {
|
||||
case GET_LICENSE_VALIDATE:
|
||||
case GET_MENU_LIST:
|
||||
|
|
|
@ -8,6 +8,7 @@ import { connect } from "react-redux"
|
|||
import { ActionCreators } from "@actions" //NOSONAR
|
||||
import PropTypes from 'prop-types'
|
||||
import { CommonActions } from "@react-navigation/native"
|
||||
import { common } from '@constants/Constants' //NOSONAR
|
||||
|
||||
class Settings extends React.Component<any, any>{
|
||||
static propTypes = {};
|
||||
|
@ -22,7 +23,8 @@ class Settings extends React.Component<any, any>{
|
|||
this.token = await AsyncStorage.getItem('token')
|
||||
|
||||
if (!this.token) {
|
||||
this.props.navigation.navigate('signin')
|
||||
//this.props.navigation.navigate('signin')
|
||||
this.props.navigation.navigate('auth')
|
||||
}
|
||||
|
||||
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.status && !this.props.isLoggedIn) {
|
||||
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('userInfo')
|
||||
await AsyncStorage.removeItem('profileInfo')
|
||||
this.props.initLogin()
|
||||
this.props.initLogin({})
|
||||
this.props.initUserProfile({})
|
||||
this.props.navigation.dispatch(
|
||||
CommonActions.reset({
|
||||
index: 0,
|
||||
|
@ -134,6 +141,9 @@ const mapDispatchToProps = (dispatch: any) => ({
|
|||
initLogin: (user: any) => {
|
||||
dispatch(ActionCreators.initLoginAction({}))
|
||||
},
|
||||
initUserProfile: (user: any) => {
|
||||
dispatch(ActionCreators.initUserProfile(user))
|
||||
},
|
||||
})
|
||||
|
||||
Settings.propTypes = {
|
||||
|
|
|
@ -50,7 +50,8 @@ class TeacherAttendance extends React.Component<any, any>{
|
|||
this.getMyCurrentLocation()
|
||||
|
||||
} 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 []
|
||||
}
|
||||
|
||||
handleConfirm = (selectedDate:any,setFieldValue: any, startTimeValue: any) => {
|
||||
this.setState({ startTimeShown: false })
|
||||
let startTime: any = startTimeValue
|
||||
if (selectedDate) {
|
||||
startTime = moment(selectedDate).format("hh:mm A")
|
||||
}
|
||||
this.setState({ start_time: { value: this.state.start_time.value } })
|
||||
setFieldValue('start_time', startTime)
|
||||
|
||||
};
|
||||
|
||||
hideDatePicker = () => {
|
||||
this.setState({ startTimeShown: false })
|
||||
};
|
||||
|
||||
handleConfirm = (selectedDate:any,setFieldValue: any, timeValue: any, key:any) => {
|
||||
if(key == 'start_time'){
|
||||
let startTime: any = timeValue
|
||||
if (selectedDate) {
|
||||
startTime = moment(selectedDate).format("hh:mm A")
|
||||
}
|
||||
this.setState({ start_time: { value: this.state.start_time.value },startTimeShown: false })
|
||||
setFieldValue('start_time', startTime)
|
||||
}else{
|
||||
let time: any = timeValue
|
||||
if (selectedDate) {
|
||||
time = moment(selectedDate).format("hh:mm A")
|
||||
}
|
||||
this.setState({ end_time: { value: this.state.end_time.value },endTimeShown: false })
|
||||
setFieldValue('end_time', time)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
hideDatePicker = () => {
|
||||
this.setState({ startTimeShown: false, endTimeShown:false})
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
let schoolInfo: any = {}
|
||||
|
@ -340,8 +348,6 @@ class SchoolUpdate extends React.Component<any, any>{
|
|||
schoolInfo = this.props.info.data
|
||||
}
|
||||
}
|
||||
console.log("SCL")
|
||||
console.log(schoolInfo)
|
||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||
|
||||
<Text style={BaseStyles.topHeader}>Update School Details</Text>
|
||||
|
@ -461,7 +467,7 @@ class SchoolUpdate extends React.Component<any, any>{
|
|||
{this.state.startTimeShown && <DateTimePickerModal
|
||||
isVisible={this.state.startTimeShown}
|
||||
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}
|
||||
date={this.state.start_time.value}
|
||||
/>
|
||||
|
@ -474,8 +480,22 @@ class SchoolUpdate extends React.Component<any, any>{
|
|||
<Text style={styles.icon}
|
||||
onPress={this.endTimePicker.bind(this, 'end_time', setFieldValue, values.end_time)}><Ionicons name={"time"} size={18} /></Text>
|
||||
</View>
|
||||
{this.state.endTimeShown && <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} />}
|
||||
{this.state.endTimeShown &&
|
||||
// <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>
|
||||
{(errors.start_time && touched.start_time) && <Text style={AppStyles.error}>{errors.start_time}</Text>}
|
||||
|
|
Loading…
Reference in New Issue