@netsells/storybook-nuxt-auth
| Install | |
|---|---|
npm install @netsells/storybook-nuxt-auth |
|
| Latest Version: | 0.1.0 |
| License: | MIT |
| Last Updated: | Aug 4, 2021 |
| Links: | GitHub · npm |
@netsells/storybook-nuxt-auth
This package provides an easy and convenient way to mock your nuxt auth state in your stories.
Installation
$ yarn add -D @netsells/storybook-nuxt-auth
Usage
Setup
Provide the decorator in your storybook decorators config:
import withNuxtAuth from '@netsells/storybook-nuxt-auth';
export default [
withNuxtAuth,
];
Stories
To mock a specific auth config in your stories, you can simply provide the auth parameter with your desired data:
export default {
parameters: {
auth: {
loggedIn: true,
user: {
first_name: 'Jane',
last_name: 'Smith',
email: 'jane.smith@example.com',
},
},
},
};
You can also provide auth data to specific stories if required:
story.parameters = {
auth: {
loggedIn: true,
user: {
first_name: 'Jane',
last_name: 'Doe',
email: 'jane.doe@example.com',
},
},
};
You can add any data here that you would expect to see in the actual $auth object provided by @nuxtjs/auth in your nuxt application, including callbacks such as login() and loginWith() if you need to mock auth functionality.
This decorator will wrap your stories in a NuxtAuth component, which can be inspected in Vue Dev Tools to see the currently applied auth config.
Related Packages
This package provides an easy and convenient way to provide routes to your Vue-b...
Version History
| Version | Released | License |
|---|---|---|
| 0.1.0 | MIT |