This repository was archived by the owner on Oct 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 22import type { LoaderFunction } from '@remix-run/node'
33import { Login as LoginPage } from '@cuhacking/portal/pages/login'
44import { redirect } from '@remix-run/node'
5+ import { commitSession , getSession } from '../sessions'
56
67export const loader : LoaderFunction = async ( { request } ) => {
78 const cookie = request . headers . get ( 'Cookie' )
89
910 try {
10- const res = await fetch ( `${ process . env . NODE_ENV === 'development' ? process . env . CUHACKING_2025_PORTAL_LOCAL_URL : process . env . CUHACKING_2025_PORTAL_PUBLIC_URL } /api/users/me` , {
11+ const res = await fetch ( `${ process . env . NODE_ENV === 'development' ? process . env . CUHACKING_2025_AXIOM_LOCAL_URL : process . env . CUHACKING_2025_AXIOM_PUBLIC_URL } /api/users/me` , {
1112 headers : { Cookie : cookie || '' } ,
1213 } )
1314
@@ -17,8 +18,16 @@ export const loader: LoaderFunction = async ({ request }) => {
1718
1819 const data = await res . json ( )
1920
21+ const session = await getSession ( cookie )
22+ session . set ( 'userId' , data . user . id )
23+ const newCookie = await commitSession ( session )
24+
2025 if ( data ?. user ) {
21- return redirect ( '/dashboard' )
26+ return redirect ( '/' , {
27+ headers : {
28+ 'Set-Cookie' : newCookie || '' ,
29+ } ,
30+ } )
2231 }
2332 }
2433 catch ( error ) {
You can’t perform that action at this time.
0 commit comments