feat: 用户账户系统

This commit is contained in:
Junyan Qin
2024-11-17 19:11:44 +08:00
parent 036c2182a5
commit 20e3edba8f
23 changed files with 543 additions and 102 deletions

View File

@@ -16,6 +16,16 @@ export function registerPlugins (app) {
.use(router)
.use(store)
// 读取用户令牌
const token = localStorage.getItem('user-token')
if (token) {
store.state.user.jwtToken = token
}
// 所有axios请求均携带用户令牌
axios.defaults.headers.common['Authorization'] = `Bearer ${store.state.user.jwtToken}`
app.config.globalProperties.$axios = axios
store.commit('initializeFetch')
}