When using vue-resource to send an ajax request in laravel, sometimes an error of inconsistent token will be returned, which is the picture below:
Question:
Instead of making this error disappear, how to get this error information in the response of the following error callback
?
{
// GET /someUrl
this.$http.get('/someUrl').then((response) => {
// success callback
}, (response) => {
// error callback
});
}
天蓬老师2017-05-16 16:52:59
AppExceptionsHandler This class can customize exception handling laravel 5.3`
public function render($request, Exception $exception)
{
if($exception instanceof TokenMismatchException){
//你的响应
}
return parent::render($request, $exception);
}`