登录接口联调完成
This commit is contained in:
@@ -50,7 +50,10 @@ export default {
|
||||
// 登录接口接入后在这里提交账号和密码
|
||||
// 这里模拟登录成功,直接跳转到聊天页面
|
||||
if (this.username && this.password) {
|
||||
login(this.username, this.password)
|
||||
login({
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
})
|
||||
.then((response) => {
|
||||
const token = response.data.token;
|
||||
this.$store.commit("SET_TOKEN", token);
|
||||
|
||||
@@ -15,7 +15,7 @@ request.interceptors.request.use(
|
||||
// 在请求头中添加token
|
||||
const token = store.state.token;
|
||||
if (token) {
|
||||
config.headers['Authorization'] = `Bearer ${token}`;
|
||||
config.headers['Authorization'] = `${token}`;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user