进一步重构社交登陆的实现

This commit is contained in:
YunaiV
2022-04-26 23:36:26 +08:00
parent 878445a238
commit 7227664f77
21 changed files with 155 additions and 134 deletions

View File

@ -1,4 +1,4 @@
import {login, logout, getInfo, socialLogin, socialLogin2} from '@/api/login'
import {login, logout, getInfo, socialQuickLogin, socialBindLogin} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
@ -57,7 +57,7 @@ const user = {
const state = userInfo.state
const type = userInfo.type
return new Promise((resolve, reject) => {
socialLogin(type, code, state).then(res => {
socialQuickLogin(type, code, state).then(res => {
res = res.data;
setToken(res.token)
commit('SET_TOKEN', res.token)
@ -76,7 +76,7 @@ const user = {
const username = userInfo.username.trim()
const password = userInfo.password
return new Promise((resolve, reject) => {
socialLogin2(type, code, state, username, password).then(res => {
socialBindLogin(type, code, state, username, password).then(res => {
res = res.data;
setToken(res.token)
commit('SET_TOKEN', res.token)