tai2 / webpacker-react-example

Rails modern front-end example using Webpacker 3.
22 stars 3 forks source link

CSRF in Storybook #10

Closed PascalPixel closed 5 years ago

PascalPixel commented 5 years ago

I need a CSRF token to retrieve data in some Components, but am unsure how to handle that in Storybook, as it is a separate instance of webpack.

It seems even rails-ujs just retrieves the token from a meta tag.

Any ideas or just use fake data for Storybook?

tai2 commented 5 years ago

@Superpencil

It looks weird to me that Storybook needs CSRF token. Decoupling presentation and logic is a better way I think. Storybook should be used for just presentation.

By the way, there may be some solutions for that situation.