Ant-design-pro: v4 连接服务器登陆 重复发送2次请求

Created on 3 Jul 2019  ·  11Comments  ·  Source: ant-design/ant-design-pro

环境:使用master分支,v4版
向后台服务器发送请求时,同一请求会重复发送2次
WX20190703-154327@2x

Most helpful comment

https://juejin.im/post/5c46af87e51d4552232feaeb
https://juejin.im/post/5b14a3f76fb9a01e72512101
https://www.cnblogs.com/virtual/p/3720750.html

你发的这些是解释跨域为什么发option和post。
我问的是输入密码登录回车为什么发了4次(2次option+2次post),见上图。

看了源码, onPressEnter 缺少e.preventDefault(),已提交pr到umi-blocks
WX20190708-155324@2x

All 11 comments

cors,跨域请求了吧

密码框回车和默认提交被同时触发了

目测是跨域

v2版本 跨域也没见重复发2次请求啊,这不是bug吗

你看看你的请求,如果是跨域,一次是 Option 一次是 Post

你看看你的请求,如果是跨域,一次是 Option 一次是 Post

一次登录操作,发了4个请求,如上图,前2个200是option,后2个401是post,是重复发了2次吗

https://juejin.im/post/5c46af87e51d4552232feaeb
https://juejin.im/post/5b14a3f76fb9a01e72512101
https://www.cnblogs.com/virtual/p/3720750.html

你发的这些是解释跨域为什么发option和post。
我问的是输入密码登录回车为什么发了4次(2次option+2次post),见上图。

看了源码, onPressEnter 缺少e.preventDefault(),已提交pr到umi-blocks
WX20190708-155324@2x

你看看你的请求,如果是跨域,一次是 Option 一次是 Post

和跨域没关系
onPressEnter 的时候漏了e.preventDefault();

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RichardStark picture RichardStark  ·  3Comments

wuyongdec picture wuyongdec  ·  3Comments

zhongjiewu picture zhongjiewu  ·  3Comments

suifan picture suifan  ·  3Comments

yadongxie150 picture yadongxie150  ·  3Comments