[bailicangdu/vue2-elm]登录时总是用户名参数错误

2024-02-05 782 views
5

这个要怎么解决啊,求解 ` if (type === 'post') { config = { baseURL: '', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, withCredentials:true, url: url, method: type, }; Object.defineProperty(config, 'body', { value: JSON.stringify(data) }); console.log('axios config object is ', config); }

try{
    const response = await ajax(config);
    return response;
}catch(error){
    throw new Error(error);
}

`

export const login = (username, password, captcha_code) => axios('/v2/login', { username, password, captcha_code }, 'post');

login(this.username, this.password, this.verifyCode).then( res => { console.log('login ', res); });

image

回答

1

怎么解决的

8

我也遇到登录用户名参数错误 在我使用自己创建的项目提交登录请求的时候我查看后台node-elm,发现 nonedata 这个fields是个空值,但是当我用本地命令跑作者的项目的时候提交请求是能够拿到正常值的。然后我再想究竟是哪里出错了,感觉代理没有问题啊。


我的这个问题解决了,是我的前台代码的问题,fetch里面的参数设置错了,把mode设置成了‘no-cors’,应该设置成‘cors’ image

5

真的看不出哪里错了,现在都还没解决

9

我设置成这样也不行