Skip to content

Allow showing loading permission state

Choose a tag to compare

@bbrighter bbrighter released this 19 Jan 19:47
· 38 commits to main since this release
13a5bbe

Extended the AuthStateAdapter interface by isLoadedandsetIsLoaded` to display loading state.

useProductInstances(): {
     instances: readonly ProductInstance[]
     setInstances: (_: Array<ProductInstance>) => void
     isLoaded: boolean
     setIsLoaded: (_: boolean) => void
    }

Usage example:

import { useAuth } from '@bbrighter/auth-module/auth'
import Backdrop from '@mui/material/Backdrop'
import CircularProgress from '@mui/material/CircularProgress'

export const PermissionLoader = () => {
    const { isLoaded, token } = useAuth()

    return (
        <Backdrop
            data-testid="permission-backdrop"
            open={!isLoaded && token != ''}
            sx={theme => ({ color: '#fff', zIndex: theme.zIndex.drawer + 1 })}
        >
            <CircularProgress size={75} />
        </Backdrop>
    )
}