hookehuyr

fix(authRedirect): 修复检查用户是否有家庭时的数据判断逻辑

修复当data对象存在但families字段不存在时的判断错误,使用可选链操作符确保安全访问
1 /* 1 /*
2 * @Date: 2025-01-25 10:00:00 2 * @Date: 2025-01-25 10:00:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-13 09:07:59 4 + * @LastEditTime: 2025-09-23 14:33:30
5 * @FilePath: /lls_program/src/utils/authRedirect.js 5 * @FilePath: /lls_program/src/utils/authRedirect.js
6 * @Description: 授权重定向处理工具函数 6 * @Description: 授权重定向处理工具函数
7 */ 7 */
...@@ -69,7 +69,7 @@ export const navigateToAuth = (returnPath) => { ...@@ -69,7 +69,7 @@ export const navigateToAuth = (returnPath) => {
69 export const checkUserHasFamily = async () => { 69 export const checkUserHasFamily = async () => {
70 try { 70 try {
71 const { code, data } = await getMyFamiliesAPI() 71 const { code, data } = await getMyFamiliesAPI()
72 - if (code && data && data.length > 0) { 72 + if (code && data && data?.families?.length > 0) {
73 return true 73 return true
74 } 74 }
75 return false 75 return false
......