File tree Expand file tree Collapse file tree 4 files changed +35
-8
lines changed
Expand file tree Collapse file tree 4 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,14 @@ import { betterAuth } from "better-auth";
22import { drizzleAdapter } from "better-auth/adapters/drizzle" ;
33import { anonymous } from "better-auth/plugins" ;
44import { eq } from "drizzle-orm" ;
5+ import * as schema from "../lib/db/schema" ;
56import { getDB } from "./db" ;
67
78export function getAuth ( env ?: Env ) {
89 const auth = betterAuth ( {
910 database : drizzleAdapter ( getDB ( env ) , {
1011 provider : "pg" ,
12+ schema : schema ,
1113 } ) ,
1214 emailAndPassword : {
1315 enabled : true ,
Original file line number Diff line number Diff line change 11import { drizzle as drizzleNeon } from "drizzle-orm/neon-http" ;
22import { drizzle as drizzlePg } from "drizzle-orm/node-postgres" ;
3- import { Link } from "react-router" ;
3+ import type { c } from "node_modules/better-auth/dist/shared/better-auth.C9FmyZ5W.cjs" ;
4+ import { Link , useNavigate } from "react-router" ;
5+ import { authClient } from "~/lib/auth-client" ;
46import { getRedisClient } from "~/lib/redis" ;
57import type { Route } from "./+types/_index" ;
68
@@ -19,16 +21,25 @@ export async function loader({ context }: Route.LoaderArgs) {
1921}
2022
2123export default function Page ( ) {
24+ const navigate = useNavigate ( ) ;
25+ const anonymousLoginAndStart = async ( ) => {
26+ const _user = await authClient . signIn . anonymous ( ) ;
27+ navigate ( "/play" ) ;
28+ } ;
2229 return (
2330 < >
2431 < h1 className = "text-5xl text-center pb-1" > Hitori Mahjong</ h1 >
25- < Link to = "/start" >
26- < p className = "text-center link" > Get Started</ p >
27- </ Link >
28-
29- < Link to = "/learn" >
30- < p className = "text-center link" > Learn How to Play</ p >
31- </ Link >
32+ < div className = "flex justify-center items-center flex-col gap-4 py-4" >
33+ < button onClick = { anonymousLoginAndStart } className = "link" type = "button" >
34+ Play as Guest
35+ </ button >
36+ < Link to = "/login" className = "link" >
37+ Login
38+ </ Link >
39+ < Link to = "/learn" className = "link" >
40+ Learn How to Play
41+ </ Link >
42+ </ div >
3243 </ >
3344 ) ;
3445}
Original file line number Diff line number Diff line change 1+ export default function Page ( ) {
2+ return (
3+ < >
4+ < p > Log in</ p >
5+ </ >
6+ ) ;
7+ }
Original file line number Diff line number Diff line change 1+ export default function Page ( ) {
2+ return (
3+ < >
4+ < p > Play Page</ p >
5+ </ >
6+ ) ;
7+ }
You can’t perform that action at this time.
0 commit comments