@brightlayer-ui/react-auth-workflow
Version:
Re-usable workflow components for Authentication and Registration within Eaton applications.
19 lines (18 loc) • 500 B
JavaScript
import { useContext } from 'react';
import { ErrorContext } from './context.js';
import { ErrorContextProvider } from './provider.js';
/**
* Hook to get top level error data
*
* @category Hooks
* @private
* @internal
*/
export const useErrorContext = () => {
const context = useContext(ErrorContext);
if (context === null) {
throw new Error('useErrorContext must be used within ErrorContextProvider');
}
return context;
};
export { ErrorContext, ErrorContextProvider };