L5-Swagger: actions.js:453 TypeError: Cannot set property 'X-CSRF-TOKEN' of undefined

  • L5-Swagger Version: 1.10.10 (composer show | grep l5-swagger)
  • PHP Version (php -7.4):
  • OS: ubuntu 19+

Description:

actions.js:453 TypeError: Cannot set property ‘X-CSRF-TOKEN’ of undefined image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @gromov-io , You can temporary fix it. Export the view resources resources/views/index.blade.php https://github.com/DarkaOnLine/L5-Swagger/blob/b64efe3e05c339b64d19653b200900da4ed4edb5/resources/views/index.blade.php#L84

And change the function at line 84 by this function :

requestInterceptor: function(req) {
      req.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
      return req;
},

Cheers.

@ricco381,

Use publish command php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"

The file will be publish on our resources :

Copied Directory [/vendor/darkaonline/l5-swagger/resources/views] To [/resources/views/vendor/l5-swagger]

Go to /resources/views/vendor/l5-swagger/index.blade.php change the function like you want.

Regards

While I pull updated file which contains on line 84 of /resources/views/vendor/l5-swagger

 requestInterceptor: function() {
      this.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
      return this;
    },

does not work so I updated as per @ricco381 on line 84

requestInterceptor: function(req) {
      req.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
      return req;
    },

А меня тоже такая ошибка, как это исправить??