我是Axios拦截器的新手,我无法弄清楚这段代码有什么问题。这是使用Axios Interceptor进行发布请求传递数据(正文)的正确方法吗?
import axios from 'axios';
export const userService = {
login
};
const axiosInstance = axios.create({
baseURL: 'https://**********/api/v1'
})
const loginRequestHandler = (request) => {
request.data['email','password']={email,password}
return request
}
axios.interceptors.request.use(
request => loginRequestHandler(request),
error => Promise.reject(error)
);
function login(handlerEnabled){
axiosInstance.post('/auth/local',{handlerEnabled})
}