File tree Expand file tree Collapse file tree 1 file changed +1
-20
lines changed
Expand file tree Collapse file tree 1 file changed +1
-20
lines changed Original file line number Diff line number Diff line change 1- import { drizzle as drizzleNeon } from "drizzle-orm/neon-http" ;
2- import { drizzle as drizzlePg } from "drizzle-orm/node-postgres" ;
3- import type { c } from "node_modules/better-auth/dist/shared/better-auth.C9FmyZ5W.cjs" ;
41import { Link , useNavigate } from "react-router" ;
52import { authClient } from "~/lib/auth-client" ;
6- import { getRedisClient } from "~/lib/redis" ;
7- import type { Route } from "./+types/_index" ;
8-
9- export async function loader ( { context } : Route . LoaderArgs ) {
10- const { env } = context . cloudflare ;
11- const db =
12- env . NODE_ENV === "development"
13- ? drizzlePg ( env . DATABASE_URL )
14- : drizzleNeon ( env . DATABASE_URL ) ;
15- const redisClient = getRedisClient ( env ) ;
16- redisClient . on ( "error" , ( err ) => console . log ( "Redis Client Error" , err ) ) ;
17- await redisClient . connect ( ) ;
18- await redisClient . set ( "key" , "value" ) ;
19- const value = await redisClient . get ( "key" ) ;
20- console . log ( value ) ;
21- }
223
234export default function Page ( ) {
245 const navigate = useNavigate ( ) ;
256 const anonymousLoginAndStart = async ( ) => {
267 const user = await authClient . getSession ( ) ;
27- if ( ! user ) {
8+ if ( ! user . data ) {
289 const _user = await authClient . signIn . anonymous ( ) ;
2910 }
3011 navigate ( "/play" ) ;
You can’t perform that action at this time.
0 commit comments