Преглед изворни кода

♻️ refactor(profile): 移除未使用的注销功能代码

- 从 useAuth 钩子中移除未使用的 logout 方法解构
- 将 handleLogout 函数及相关 UI 交互逻辑注释掉,以备未来可能的恢复或重构
yourname пре 2 недеља
родитељ
комит
e8b98a5549
1 измењених фајлова са 30 додато и 30 уклоњено
  1. 30 30
      mini/src/pages/profile/index.tsx

+ 30 - 30
mini/src/pages/profile/index.tsx

@@ -19,7 +19,7 @@ import { creditBalanceClient } from '@/api'
 import './index.css'
 
 const ProfilePage: React.FC = () => {
-  const { user: userProfile, logout, isLoading: loading, updateUser, refreshUser } = useAuth()
+  const { user: userProfile, isLoading: loading, updateUser, refreshUser } = useAuth()
   const [showCustomerService, setShowCustomerService] = useState(false)
   const [showEditProfile, setShowEditProfile] = useState(false)
   // const [editingAvatar, setEditingAvatar] = useState<string | undefined>(undefined)
@@ -81,35 +81,35 @@ const ProfilePage: React.FC = () => {
     })
   })
 
-  const handleLogout = async () => {
-    try {
-      Taro.showModal({
-        title: '退出登录',
-        content: '确定要退出登录吗?',
-        success: async (res) => {
-          if (res.confirm) {
-            Taro.showLoading({ title: '退出中...' })
-            await logout()
-            Taro.hideLoading()
-            Taro.showToast({
-              title: '已退出登录',
-              icon: 'success',
-              duration: 1500
-            })
-            setTimeout(() => {
-              Taro.reLaunch({ url: '/pages/index/index' })
-            }, 1500)
-          }
-        }
-      })
-    } catch (error) {
-      Taro.hideLoading()
-      Taro.showToast({
-        title: '退出失败,请重试',
-        icon: 'none'
-      })
-    }
-  }
+  // const handleLogout = async () => {
+  //   try {
+  //     Taro.showModal({
+  //       title: '退出登录',
+  //       content: '确定要退出登录吗?',
+  //       success: async (res) => {
+  //         if (res.confirm) {
+  //           Taro.showLoading({ title: '退出中...' })
+  //           await logout()
+  //           Taro.hideLoading()
+  //           Taro.showToast({
+  //             title: '已退出登录',
+  //             icon: 'success',
+  //             duration: 1500
+  //           })
+  //           setTimeout(() => {
+  //             Taro.reLaunch({ url: '/pages/index/index' })
+  //           }, 1500)
+  //         }
+  //       }
+  //     })
+  //   } catch (error) {
+  //     Taro.hideLoading()
+  //     Taro.showToast({
+  //       title: '退出失败,请重试',
+  //       icon: 'none'
+  //     })
+  //   }
+  // }
 
 
   const handleEditProfile = () => {