import React, { createContext, useContext } from 'react'

// 创建认证上下文
export const AuthContext = createContext()

// 认证上下文Hook
export const useAuth = () => {
  const context = useContext(AuthContext)
  if (!context) {
    throw new Error('useAuth must be used within an AuthProvider')
  }
  return context
}