feat: enhance login status management and improve error logging across services

This commit is contained in:
zimplexing
2025-07-15 21:41:38 +08:00
parent 116cf12ca3
commit d44e9fe9ae
17 changed files with 62 additions and 57 deletions

View File

@@ -11,7 +11,7 @@ import { StyledButton } from "./StyledButton";
const LoginModal = () => {
const { isLoginModalVisible, hideLoginModal, checkLoginStatus } = useAuthStore();
const { serverConfig } = useSettingsStore();
const { serverConfig, apiBaseUrl } = useSettingsStore();
const { refreshPlayRecords } = useHomeStore();
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
@@ -28,7 +28,7 @@ const LoginModal = () => {
setIsLoading(true);
try {
await api.login(isLocalStorage ? undefined : username, password);
await checkLoginStatus();
await checkLoginStatus(apiBaseUrl);
await refreshPlayRecords();
Toast.show({ type: "success", text1: "登录成功" });
hideLoginModal();

View File

@@ -112,7 +112,7 @@ export default function VideoCard({
router.replace("/");
}
} catch (error) {
console.error("Failed to delete play record:", error);
console.info("Failed to delete play record:", error);
Alert.alert("错误", "删除观看记录失败,请重试");
}
},