Первоначальная версия VidConf
This commit is contained in:
9
frontend/src/auth/useAuth.ts
Normal file
9
frontend/src/auth/useAuth.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useContext } from 'react'
|
||||
import { AuthContext, type AuthContextValue } from '@/auth/authContext'
|
||||
|
||||
/** Хук доступа к текущей сессии пользователя. Должен использоваться внутри AuthProvider. */
|
||||
export function useAuth(): AuthContextValue {
|
||||
const ctx = useContext(AuthContext)
|
||||
if (!ctx) throw new Error('useAuth должен использоваться внутри <AuthProvider>')
|
||||
return ctx
|
||||
}
|
||||
Reference in New Issue
Block a user