perf:优化OAuth登录

This commit is contained in:
不做码农
2022-07-02 16:50:57 +08:00
parent f10f608d9a
commit 6061592084
3 changed files with 10 additions and 8 deletions
+3 -4
View File
@@ -42,11 +42,12 @@ const useUserStore = defineStore('user', {
/**
* 三方授权登录
* @param {*} data
* @param { *} param { authSource : ''}
* @returns
*/
oauthLogin(data) {
oauthLogin(data, param) {
return new Promise((resolve, reject) => {
oauthCallback(data, { authSource: this.authSource }).then(res => {
oauthCallback(data, param).then(res => {
const { code, data } = res
if (code == 200) {
setToken(data.token)
@@ -59,8 +60,6 @@ const useUserStore = defineStore('user', {
console.log('login error ', res)
reject(res) //catch处理
}
}).catch(error => {
reject(error)
})
})
},