vue-resource - How to get csrftoken inconsistent error in laravel
我想大声告诉你
我想大声告诉你 2017-05-16 16:50:59
0
1
496

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
  });
}
我想大声告诉你
我想大声告诉你

reply all(1)
Peter_Zhu

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);
    }`
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template