|
@@ -41,12 +41,15 @@ export const useCommonStore = defineStore(
|
|
|
* 设置已经登陆的账号列表 (在登陆成功后调用)
|
|
|
*/
|
|
|
const pushAccount = (user: any) => {
|
|
|
- if (!user || !user.email)
|
|
|
+ if (!user.id)
|
|
|
return
|
|
|
- // 检查是否已经存在相同的账号
|
|
|
- const existingAccount = accountList.value.find((item: any) => item.email === user.email && item.type === user.type)
|
|
|
- if (existingAccount)
|
|
|
+ // 查找相同的id,并更新email和name信息
|
|
|
+ const existingAccount = accountList.value.find((item: any) => item.id === user.id)
|
|
|
+ if (existingAccount) {
|
|
|
+ existingAccount.email = user.email
|
|
|
+ existingAccount.name = `${user.firstName} ${user.lastName}`
|
|
|
return
|
|
|
+ }
|
|
|
accountList.value.push(user)
|
|
|
}
|
|
|
/**
|