refactor: 优化用户认证逻辑,移除未使用的注销功能和用户信息展示

This commit is contained in:
2025-12-21 01:13:55 +07:00
parent a4034b6b78
commit b957eb7cc2
2 changed files with 7 additions and 21 deletions

View File

@@ -3,9 +3,12 @@ export function beforeApp() {
const { initializeWallet } = useWalletStore(); const { initializeWallet } = useWalletStore();
return new Promise<void>((resolve) => { return new Promise<void>((resolve) => {
useAuth().then(() => { useAuth().then((session) => {
updateProfile(); if (session) {
initializeWallet(); updateProfile();
initializeWallet();
}
resolve(); resolve();
}); });
}); });

View File

@@ -1,13 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { authClient } from "@/auth";
const { user } = useAuth();
const tradingViewContainer = useTemplateRef<HTMLElement>("tradingViewContainer"); const tradingViewContainer = useTemplateRef<HTMLElement>("tradingViewContainer");
async function handleLogout() {
await authClient.signOut();
}
useTradingView(tradingViewContainer, { useTradingView(tradingViewContainer, {
data: [ data: [
// 随机k线图数据 // 随机k线图数据
@@ -25,22 +18,12 @@ useTradingView(tradingViewContainer, {
<template> <template>
<IonPage> <IonPage>
<IonHeader> <IonHeader>
<IonToolbar class="ui-tabbar"> <IonToolbar class="ui-toolbar">
<IonTitle>Home</IonTitle> <IonTitle>Home</IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonButton @click="$router.push('/auth/login')">
Log in
</IonButton>
<IonButton @click="$router.push('/auth/signup')">
Sign up
</IonButton>
<IonButton @click="handleLogout">
Log out
</IonButton>
<div ref="tradingViewContainer" /> <div ref="tradingViewContainer" />
{{ user }}
</IonContent> </IonContent>
</IonPage> </IonPage>
</template> </template>