Socket
Socket
Sign inDemoInstall

storybook-axios

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-axios

Axios inspection for storybook


Version published
Weekly downloads
1.9K
decreased by-28.61%
Maintainers
1
Weekly downloads
 
Created
Source

storybook-axios

Logo

Storybook addon to inspect axios network requests.

UI

Demo

Check out the demo

Tech

Created using React, axios and antd

Installation

npm install storybook-axios

Configure

Add addon "storybook-axios" in .storybook/main.js

module.exports = {
    stories: [
        '../srcv2/**/*.stories.mdx',
        '../srcv2/**/*.stories.@(js|jsx|ts|tsx)',
    ],
    addons: [
        '@storybook/addon-essentials',
        '@storybook/addon-notes/register',
        '@storybook/addon-a11y',
        '@whitespace/storybook-addon-html',
        'storybook-axios/register'
    ],

add a decorator in .storybook/preview.js and pass in the axios instance which is used in your app.

import withAxiosDecorator from 'storybook-axios';
import { getAxios } from '../utils/get-axios';

export const parameters = {
    actions: { argTypesRegex: "^on[A-Z].*" },
}

export const decorators = [withAxiosDecorator(getAxios())];

Note best way is to have an axios helper library, which creates a single instance and reuses it everywhere in the app. The decorator adds interceptors to that axios instance in order to listen for network requests.

Example

UI

Todos

[x] Make it work with FormData

Keywords

FAQs

Package last updated on 20 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc