Refactor auth hooks and add database existence check during migrations

- Consolidated `useAuthStore` into the unified `useAuth` hook for cleaner imports and consistency across frontend components.
- Enhanced database management in Alembic migrations by introducing `ensure_database_exists` to automatically create the database if missing.
This commit is contained in:
Felipe Cardoso
2025-11-03 13:16:34 +01:00
parent 2ee48bf3fa
commit 9843cf8218
3 changed files with 55 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useAuthStore } from '@/lib/stores/authStore';
import { useAuth } from '@/lib/stores';
import { useLogout } from '@/lib/api/hooks/useAuth';
import {
DropdownMenu,
@@ -67,7 +67,7 @@ function NavLink({
}
export function Header() {
const { user } = useAuthStore();
const { user } = useAuth();
const { mutate: logout, isPending: isLoggingOut } = useLogout();
const handleLogout = () => {