reactjs - 在 React 中提交登录时,我在 (Localhost)URL 中获取我的密码和电子邮件作为查询字符串吗?
问题描述
在 Localhost 中运行我的项目并提供我的登录信息后,我在我的 URL 中得到了这个
http://localhost:3000/?email-address=roopa%40gmail.com&password=roopa3
我还在我的活动中检查了“onClick”,但一切都很好..
event.preventDefault();
console.log('emailchanged')
this.setState({signinEmail: event.target.value})
}
onPasswordchange = (event) => {
event.preventDefault();
console.log('passwordchanged')
this.setState({signinPassword: event.target.value})
}
onSubmitSignin = () => {
console.log('entered onsubmitsignin..') // after this console msg again my localhost redirects me to a new signin page which giving inputs to URL as query strings
fetch('http://localhost:8050/signinpage/', {
method: 'post',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
email: this.state.signinEmail,
password: this.state.signinPassword
})
})
.then(function (response) {
console.log(response.status);
return response.json();
})
.then(res => {
if(res.ok){
this.props.onRoutechange('Home');
}
else if (!res.ok) {
throw new Error("HTTP status " + res.status);
}
})
}
我不需要我的输入在这里显示为查询字符串..!
解决方案
推荐阅读
- java - 在java中的while循环之外使用变量
- arrays - 从某个起点开始的 Ruby 增量数组
- javascript - 如何在 React 中加载图像?
- vhdl - 来自 std.textio 的函数 to_hstring 不起作用 [VHDL]
- c - SDL_CreateTextureFromSurface() 返回 NULL 表面
- r - 使用另一个数据框作为 R 中的键替换数据框中的所有值
- jena - Jena ARQ 添加更新请求元素
- python - 在 Mac OS Catalina 更新错误后 pipenv 无法正常工作:分配前引用了“original_python”
- javascript - 在来自 API 的 Angular 元素呈现后执行 Javascript 调用
- node.js - 在 node.js 中读取多行