Reactjs Axios请求响应显示的是html而不是数据
我的代码 Api路由Reactjs Axios请求响应显示的是html而不是数据,reactjs,laravel,Reactjs,Laravel,我的代码 Api路由 axios.post('api/sign-up', { name, username, sex,email, password, mobile_number, dob }).then(response=> { this.setState({err: false}); console.log(response.data) }).catch(error=> { this.refs.n
axios.post('api/sign-up', {
name, username, sex,email, password, mobile_number, dob
}).then(response=> {
this.setState({err: false});
console.log(response.data)
}).catch(error=> {
this.refs.name.value="";
this.refs.username.value="";
this.refs.password.value="";
this.refs.sex.value="";
this.refs.email.value="";
this.refs.mobile_number.value="";
this.refs.dob.value="";
this.setState({err: true});
});
它不显示任何错误,但给出html作为响应。axios有什么问题吗?请帮助添加:
Route::post('/sign-up', [App\Http\Controllers\Api\ApiAuthController::class, 'register']);
到请求的标题。您好,很有趣,它是否显示错误?不,它不显示任何错误,但返回htmlI。如果需要,可以显示屏幕截图
Accept:application/json