Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
17 lines
313 B
TypeScript
17 lines
313 B
TypeScript
import { useContext } from 'react'
|
|
|
|
import { AuthContext } from '@/context/AuthContext'
|
|
|
|
// Hook to use AuthContext
|
|
const useAuth = () => {
|
|
const context = useContext(AuthContext)
|
|
|
|
if (!context) {
|
|
throw new Error('useAuth must be used within AuthProvider')
|
|
}
|
|
|
|
return context
|
|
}
|
|
|
|
export default useAuth
|