Compare commits

..

No commits in common. "2331b05db4fcd0d3ee51c4d78c65048d0a16a3df" and "683df4a7c16aa63fe7b7b125077c029146288318" have entirely different histories.

4 changed files with 8 additions and 29 deletions

View File

@ -93,8 +93,8 @@
"typedRoutes": true "typedRoutes": true
}, },
"extra": { "extra": {
"API_ENDPOINT": "http://192.168.31.154:8080/api", "API_ENDPOINT": "http://localhost:8080/api",
"WEBSOCKET_ENDPOINT": "ws://192.168.31.154:8080/ws/chat", "WEBSOCKET_ENDPOINT": "ws://localhost:8080/ws/chat",
"router": {}, "router": {},
"eas": { "eas": {
"projectId": "04721dd4-6b15-495a-b9ec-98187c613172" "projectId": "04721dd4-6b15-495a-b9ec-98187c613172"

View File

@ -1,5 +1,5 @@
import { Asset } from 'expo-asset'; import { Asset } from 'expo-asset';
import { useLocalSearchParams, useRouter } from 'expo-router'; import { useRouter } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen'; import * as SplashScreen from 'expo-splash-screen';
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { FlatList, InteractionManager, PixelRatio, Platform, RefreshControl, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { FlatList, InteractionManager, PixelRatio, Platform, RefreshControl, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
@ -48,16 +48,6 @@ const MemoList = () => {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const flatListRef = useRef<FlatList>(null); const flatListRef = useRef<FlatList>(null);
const { t } = useTranslation(); const { t } = useTranslation();
const { next } = useLocalSearchParams<{ next: string }>();
useEffect(() => {
if (next) {
// 使用 InteractionManager 确保在动画和交互完成后执行
InteractionManager.runAfterInteractions(() => {
router.replace(next as any);
});
}
}, [next, router]);
// 从缓存或API获取数据 // 从缓存或API获取数据
const fetchHistoryList = useCallback(async (forceRefresh = false) => { const fetchHistoryList = useCallback(async (forceRefresh = false) => {

View File

@ -24,7 +24,6 @@ export default function UserMessage() {
// 获取路由参数 // 获取路由参数
const params = useLocalSearchParams(); const params = useLocalSearchParams();
const { username: usernameParam } = params; const { username: usernameParam } = params;
const { from } = useLocalSearchParams<{ from?: string }>();
useEffect(() => { useEffect(() => {
checkAuthStatus(router); checkAuthStatus(router);
@ -48,17 +47,11 @@ export default function UserMessage() {
}) })
}).then(() => { }).then(() => {
setIsLoading(false); setIsLoading(false);
if (from) { setSteps('done');
router.replace(from as any); }).catch(() => {
} else {
router.replace('/ask');
}
}).catch((error: any) => {
console.error('Failed to save user info:', error);
setIsLoading(false); setIsLoading(false);
}); });
}; };
useEffect(() => { useEffect(() => {
getUserInfo(); getUserInfo();
setSteps("userName") setSteps("userName")

View File

@ -47,16 +47,12 @@ const Login = ({ updateUrlParam, setError, setShowPassword, showPassword }: Logi
login({ ...res, email: res?.account }, res.access_token || ''); login({ ...res, email: res?.account }, res.access_token || '');
const userInfo = await fetchApi<User>("/iam/user-info"); const userInfo = await fetchApi<User>("/iam/user-info");
if (userInfo?.nickname) { if (userInfo?.nickname) {
router.replace({ pathname: '/memo-list', params: { next: '/ask' } }); router.replace('/ask');
} else { } else {
router.replace({ pathname: '/user-message', params: { from: '/memo-list' } }); router.replace('/user-message');
} }
} catch (error) { } catch (error) {
if (error instanceof Error) { setError(error.message || t('auth.login.loginError', { ns: 'login' }));
setError(error.message);
} else {
setError(String(error) || t('auth.login.loginError', { ns: 'login' }));
}
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }