UNPKG

@sky-mavis/tanto-widget

Version:
7 lines 410 B
import {useContext}from'react';import {TantoWidgetError,TantoWidgetErrorCodes}from'../../utils/errors.mjs';import {AuthContext}from'./AuthContext.mjs';function useAuth() { const context = useContext(AuthContext); if (context === undefined) { throw new TantoWidgetError(TantoWidgetErrorCodes.CONTEXT_NOT_INITIALIZED, 'useAuth must be used within a AuthProvider'); } return context; }export{useAuth};