fix: 保存用户信息后正确更新本地存储
This commit is contained in:
parent
57e2eec9a0
commit
e7939abbbe
|
|
@ -2,7 +2,7 @@
|
|||
# Version Configuration for Zodiac Collection Management System
|
||||
|
||||
# 当前版本号 (语义化版本:主版本。次版本.修订版)
|
||||
VERSION=1.1.0
|
||||
VERSION=1.1.1
|
||||
|
||||
# 版本代号 (可选)
|
||||
VERSION_CODENAME="新生"
|
||||
|
|
|
|||
|
|
@ -83,12 +83,15 @@ export default function Settings() {
|
|||
})
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
setSuccess('保存成功!')
|
||||
// 更新本地存储的用户信息
|
||||
const userStr = localStorage.getItem('user')
|
||||
if (userStr) {
|
||||
const user = JSON.parse(userStr)
|
||||
user.username = form.username
|
||||
user.username = data.username || user.username
|
||||
user.email = data.email || user.email
|
||||
user.phone = data.phone || user.phone
|
||||
localStorage.setItem('user', JSON.stringify(user))
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue