Refactor authentication and theme context usage
- Moved authentication hooks and context to a dedicated hooks directory. - Updated imports in various components and pages to use the new hooks. - Created AuthContext and ThemeContext for better state management. - Refactored ThemeProvider to utilize the new ThemeContext. - Cleaned up sidebar and button components for consistency and readability. - Ensured all components are using the latest context and hooks for authentication and theme management.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useTheme } from '@/components/ThemeProvider'
|
||||
import { useTheme } from '@/hooks/use-theme'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Card,
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from '@/components/ui/card'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
import { apiService } from '@/services/api'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
|
||||
export function AdminUsersPage() {
|
||||
const { user } = useAuth()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
import { Link } from 'react-router'
|
||||
|
||||
export function DashboardPage() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
import { authService } from '@/services/auth'
|
||||
|
||||
export function LoginPage() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
import { authService } from '@/services/auth'
|
||||
|
||||
export function RegisterPage() {
|
||||
|
||||
Reference in New Issue
Block a user