- Added user, session, account, and verification models to Prisma schema. - Integrated better-auth for user authentication with email and password. - Created auth middleware for session validation. - Implemented auth context and client in frontend for managing user sessions. - Added login and settings pages for user authentication and password management. - Updated routes to include authentication checks and user-specific content. - Enhanced UI components to reflect authentication state.
27 lines
600 B
TypeScript
27 lines
600 B
TypeScript
import { createRouter } from "@tanstack/react-router";
|
|
import { routeTree } from "./routeTree.gen";
|
|
|
|
export interface RouterContext {
|
|
auth: {
|
|
session: object | null;
|
|
isPending: boolean;
|
|
isAuthenticated: boolean;
|
|
signIn: (password: string) => Promise<void>;
|
|
signOut: () => Promise<void>;
|
|
changePassword: (currentPassword: string, newPassword: string) => Promise<void>;
|
|
};
|
|
}
|
|
|
|
const router = createRouter({
|
|
routeTree,
|
|
context: {} as RouterContext,
|
|
});
|
|
|
|
declare module "@tanstack/react-router" {
|
|
interface Register {
|
|
router: typeof router;
|
|
}
|
|
}
|
|
|
|
export { router };
|