@manta-eu/react/hooks/useAuth
Reference for @manta-eu/react/hooks/useAuth as it is on main.
Type Aliases
ContextResponse
ContextResponse =
z.infer<typeofcontextResponseSchema>
LoginStatusCheck
LoginStatusCheck =
object
Properties
isSessionValid
isSessionValid:
boolean
SessionContextFailure
SessionContextFailure =
object
Properties
extensions?
optionalextensions?:object
status?
optionalstatus?:unknown
message?
optionalmessage?:string
UseAuthResult
UseAuthResult =
object
Properties
allowedModels
allowedModels:
MantaModelId[]
canManageCustomApps
canManageCustomApps:
boolean
canManageIntegrations
canManageIntegrations:
boolean
canManageSharedMemories
canManageSharedMemories:
boolean
canManageStreams
canManageStreams:
boolean
canManageTeam
canManageTeam:
boolean
canSwitchDatastore
canSwitchDatastore:
boolean
contextFailed
contextFailed:
boolean
True when the session is valid but fetching user context failed with a server error (retryable).
datastore
datastore:
Datastore|undefined
datastoreAccessGranted
datastoreAccessGranted:
boolean
datastores
datastores:
Datastore[] |undefined
error
error:
string|undefined
inOrganization
inOrganization:
boolean
isAuthenticated
isAuthenticated:
boolean
isLoading
isLoading:
boolean
isOperator
isOperator:
boolean
isSessionValid
isSessionValid:
boolean
True when the server has confirmed the session is valid, even if context hasn’t loaded yet.
logout
logout: () =>
Promise<void>
Returns
Promise<void>
orgRoles
orgRoles:
OrgRoleDefinition[]
refetchLoginStatus
refetchLoginStatus: () =>
Promise<LoginStatusCheck>
Re-checks login status against the server, bypassing cached/stale state.
Returns
Promise<LoginStatusCheck>
user
user:
User|undefined
Variables
contextResponseSchema
constcontextResponseSchema:ZodObject<{datastoreAccessGranted:ZodDefault<ZodBoolean>;datastores:ZodArray<ZodObject<{badge:ZodOptional<ZodNullable<ZodString>>;depth:ZodOptional<ZodNullable<ZodNumber>>;id:ZodString;name:ZodString;selectable:ZodOptional<ZodNullable<ZodBoolean>>; },$strip>>;orgRoles:ZodDefault<ZodOptional<ZodArray<ZodObject<{capabilities:ZodPipe<ZodArray<ZodString>,ZodTransform<(… | … | … | … | …)[],string[]>>;groupName:ZodString;id:ZodString;label:ZodString; },$strip>>>>;user:ZodObject<{adminOrgs:ZodDefault<ZodOptional<ZodArray<ZodString>>>;canManageCustomApps:ZodDefault<ZodOptional<ZodBoolean>>;canManageIntegrations:ZodDefault<ZodOptional<ZodBoolean>>;canManageSharedMemories:ZodDefault<ZodOptional<ZodBoolean>>;canManageStreams:ZodDefault<ZodOptional<ZodBoolean>>;canManageTeam:ZodDefault<ZodOptional<ZodBoolean>>;datastore:ZodOptional<ZodNullable<ZodObject<{badge:ZodOptional<ZodNullable<ZodString>>;depth:ZodOptional<ZodNullable<ZodNumber>>;id:ZodString;name:ZodString;selectable:ZodOptional<ZodNullable<ZodBoolean>>; },$strip>>>;ZodString;id:ZodString;isOperator:ZodBoolean;memberOrgs:ZodDefault<ZodOptional<ZodArray<ZodString>>>;name:ZodOptional<ZodNullable<ZodString>>;picture:ZodOptional<ZodNullable<ZodString>>; },$strip>; },$strip>
userContextQueryKey
constuserContextQueryKey: readonly ["user-context"]
Functions
parseSessionContext()
parseSessionContext(
payload):object
Parameters
payload
unknown
Returns
object
datastoreAccessGranted
datastoreAccessGranted:
boolean
datastores
datastores:
object[]
orgRoles
orgRoles:
object[]
user
user:
object
user.adminOrgs
adminOrgs:
string[]
user.canManageCustomApps
canManageCustomApps:
boolean
user.canManageIntegrations
canManageIntegrations:
boolean
user.canManageSharedMemories
canManageSharedMemories:
boolean
user.canManageStreams
canManageStreams:
boolean
user.canManageTeam
canManageTeam:
boolean
user.datastore?
optionaldatastore?: {badge?:string|null;depth?:number|null;id:string;name:string;selectable?:boolean|null; } |null
user.email
email:
string
user.id
id:
string
user.isOperator
isOperator:
boolean
user.memberOrgs
memberOrgs:
string[]
user.name?
optionalname?:string|null
user.picture?
optionalpicture?:string|null
sessionContextFailure()
sessionContextFailure(
failure):Error|undefined
Parameters
failure
SessionContextFailure | undefined
Returns
Error | undefined
sessionEndedLogoutPath()
sessionEndedLogoutPath(
pathname):string
Parameters
pathname
string
Returns
string
useAuth()
useAuth():
UseAuthResult