@netsells/storybook-nuxt-auth

This package provides an easy and convenient way to mock your nuxt auth state in your stories.
3,390 1
Install
npm install @netsells/storybook-nuxt-auth
Latest Version:0.1.0
License:MIT
Last Updated:Aug 4, 2021
Links: GitHub  ·  npm
Maintainer: rebeccaanderton

@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

@netsells/vue-set-timeout

Use setTimeout and setInterval safely in Vue

4,000 1
@netsells/nuxt-healthcheck

Nuxt healthcheck module

1,439
@netsells/nuxt-hotjar

Nuxt hotjar plugin

34,076 19
@netsells/storybook-router

This package provides an easy and convenient way to provide routes to your Vue-b...

4,263 0

Version History

Version Released License
0.1.0 MIT