import { ActivityIndicator, Modal, Toast } from '@ant-design/react-native'; import { Ionicons } from '@expo/vector-icons'; import { Image } from 'expo-image'; import { Pressable, ScrollView, Text, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { MenuRow } from '@/components/ui/menu-row'; import api from '@/utils/api'; import { signOut, useAuthContext } from '@/utils/auth'; import { useSWC } from '@/utils/cache'; export default function ProfileScreen() { const { setToken } = useAuthContext(); const handleLogout = () => { Modal.alert('退出登录', '确定要退出当前账号吗?', [ { text: '取消', style: 'cancel' }, { text: '退出', style: 'destructive', onPress: async () => { const l = Toast.loading("请稍候"); try { await signOut(); } catch(e) { console.warn(e); } setToken(null); Toast.remove(l); }, }, ]); }; const {data: userInfo, loading}: any = useSWC("me", async ()=> { return await api.post('user/profile') }, { cacheOnly: true, cacheTimeout: 15*60 }); if (loading) { return ; } return ( 贷款助手 {userInfo?.avatar&&} {userInfo?.nickname} 高级信贷经理 · 智融金融 128 已完成 94% 成功率 ¥42k 本月收入 退出登录 ); }