import React from 'react' import { type Meta } from '@storybook/react-vite' import { errorCheck } from '../../services/HelperServiceTyped' import { DocsTemplate } from '../../../.storybook' export const Example = (args: { /** The error code received. */ errorCode: number /** The callback to handle the error */ callback: () => void /** Optional value to pass back to the callback */ value?: string }): React.JSX.Element => { return ( <> Check console for output. {errorCheck(args.errorCode, args.callback, args.value)} ) } Example.storyName = 'errorCheck' Example.args = { errorCode: 503, callback: (value: string) => console.log('callback', value), } export default { title: 'Helper Functions/errorCheck', component: Example, parameters: { viewMode: 'docs', previewTabs: { canvas: { hidden: true }, }, docs: { page: () => ( <> console.log('callback', value), 'value') Output to console: 'value'`} description='A function used to act on an error from an api.' infoBullets={[ errorCheck is used when you need to handle an api error. , ]} /> ), }, }, } as Meta