mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 01:51:36 -04:00

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>
15 lines
514 B
TypeScript
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)
|
|
}
|