feat: implement user balance management with hooks and store
This commit is contained in:
@@ -21,6 +21,7 @@ import { signOut } from '@/lib/auth'
|
||||
import { useTemplateGenerations, type TemplateGeneration } from '@/hooks'
|
||||
import { MySkeleton } from '@/components/skeleton/MySkeleton'
|
||||
import { useSession } from '@/lib/auth'
|
||||
import { useUserBalance } from '@/hooks/use-user-balance'
|
||||
|
||||
const { width: screenWidth } = Dimensions.get('window')
|
||||
const GALLERY_GAP = 2
|
||||
@@ -38,6 +39,9 @@ export default function My() {
|
||||
const { t, i18n } = useTranslation()
|
||||
const [editDrawerVisible, setEditDrawerVisible] = useState(false)
|
||||
|
||||
// 获取积分余额
|
||||
const { balance } = useUserBalance()
|
||||
|
||||
// 获取当前登录用户信息
|
||||
const { data: session } = useSession()
|
||||
const userName = session?.user?.name || session?.user?.username || '用户'
|
||||
@@ -133,7 +137,7 @@ export default function My() {
|
||||
onPress={() => router.push('/membership' as any)}
|
||||
>
|
||||
<PointsIcon />
|
||||
<Text style={styles.pointsPillText}>60</Text>
|
||||
<Text style={styles.pointsPillText}>{balance}</Text>
|
||||
</Pressable>
|
||||
<Dropdown
|
||||
options={settingsOptions}
|
||||
|
||||
Reference in New Issue
Block a user