我正在尝试为React应用编写注销功能,但无法正常工作。
handleLogout () { API.logout() .then(res => this.props.history.push('/login')) .catch(err => console.error(err)); }
res变成灰色,编辑器说它的功能从不读取。我究竟做错了什么?
我在按钮标签中调用该函数:
<button id="logout" onClick={this.handleLogout} className="btn">LOG OUT</button>
[我正在尝试为React应用编写注销功能,但无法正常工作。.handleLogout(){API.logout().then(res => this.props.history.push('/ login')) .catch(err => console ....
正如Jayce444告诉编辑者有关res的警告与注销功能失败无关。打开开发工具,然后查看网络标签,为什么api失败