Fix state errors
这个提交包含在:
父节点
541c002558
当前提交
ffa4cfa376
共有 5 个文件被更改,包括 18 次插入 和 5 次删除
|
@ -22,7 +22,7 @@ type Props = {
|
|||
onResetPasswordPress: () => void;
|
||||
};
|
||||
|
||||
const ICON_AMICALE = require('../../../assets/amicale.png');
|
||||
const ICON_AMICALE = require('../../../../assets/amicale.png');
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
card: {
|
||||
|
|
|
@ -33,6 +33,7 @@ function LogoutDialog(props: PropsType) {
|
|||
const onClickAccept = async (): Promise<void> => {
|
||||
return new Promise((resolve: () => void) => {
|
||||
onLogout();
|
||||
props.onDismiss();
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -128,7 +128,10 @@ function VoteSelect(props: Props) {
|
|||
message={i18n.t('screens.vote.select.dialogMessage')}
|
||||
/>
|
||||
<ErrorDialog
|
||||
visible={currentError.status !== REQUEST_STATUS.SUCCESS}
|
||||
visible={
|
||||
currentError.status !== REQUEST_STATUS.SUCCESS ||
|
||||
currentError.code !== undefined
|
||||
}
|
||||
onDismiss={onErrorDialogDismiss}
|
||||
status={currentError.status}
|
||||
code={currentError.code}
|
||||
|
|
|
@ -407,7 +407,10 @@ function EquipmentRentScreen(props: Props) {
|
|||
/>
|
||||
|
||||
<ErrorDialog
|
||||
visible={currentError.status !== REQUEST_STATUS.SUCCESS}
|
||||
visible={
|
||||
currentError.status !== REQUEST_STATUS.SUCCESS ||
|
||||
currentError.code !== undefined
|
||||
}
|
||||
onDismiss={onErrorDialogDismiss}
|
||||
status={currentError.status}
|
||||
code={currentError.code}
|
||||
|
|
|
@ -35,11 +35,13 @@ import LoginForm from '../../components/Amicale/Login/LoginForm';
|
|||
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
||||
import { TabRoutes } from '../../navigation/TabNavigator';
|
||||
import { useShouldShowMascot } from '../../context/preferencesContext';
|
||||
import { useLogin } from '../../context/loginContext';
|
||||
|
||||
type Props = StackScreenProps<MainStackParamsList, 'login'>;
|
||||
|
||||
function LoginScreen(props: Props) {
|
||||
const navigation = useNavigation<StackNavigationProp<any>>();
|
||||
const { setLogin } = useLogin();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [nextScreen, setNextScreen] = useState<string | undefined>(undefined);
|
||||
const [mascotDialogVisible, setMascotDialogVisible] = useState(false);
|
||||
|
@ -88,11 +90,12 @@ function LoginScreen(props: Props) {
|
|||
* Navigates to the screen specified in navigation parameters or simply go back tha stack.
|
||||
* Saves in user preferences to not show the login banner again.
|
||||
*/
|
||||
const handleSuccess = () => {
|
||||
const handleSuccess = (token: string) => {
|
||||
// Do not show the home login banner again
|
||||
if (homeMascot.shouldShow) {
|
||||
homeMascot.setShouldShow(false);
|
||||
}
|
||||
setLogin(token);
|
||||
if (!nextScreen) {
|
||||
navigation.goBack();
|
||||
} else {
|
||||
|
@ -138,7 +141,10 @@ function LoginScreen(props: Props) {
|
|||
emotion={MASCOT_STYLE.NORMAL}
|
||||
/>
|
||||
<ErrorDialog
|
||||
visible={currentError.status !== REQUEST_STATUS.SUCCESS}
|
||||
visible={
|
||||
currentError.status !== REQUEST_STATUS.SUCCESS ||
|
||||
currentError.code !== undefined
|
||||
}
|
||||
onDismiss={hideErrorDialog}
|
||||
status={currentError.status}
|
||||
code={currentError.code}
|
||||
|
|
正在加载…
在新工单中引用