hedgedoc/frontend/src/hooks/common/use-is-logged-in.ts
Erik Michelson 167135a8d0
feat(auth): add guest login
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-05-29 00:01:27 +00:00

15 lines
514 B
TypeScript

/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplicationState } from './use-application-state'
import { AuthProviderType } from '@hedgedoc/commons'
/**
* Hook to check if currently a user is logged in.
* @return True, if a user is logged in. False otherwise.
*/
export const useIsLoggedIn = () => {
return useApplicationState((state) => state.user !== null && state.user.authProvider !== AuthProviderType.GUEST)
}