This repository was archived by the owner on Oct 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-17
lines changed
libs/portal/features/login/ui Expand file tree Collapse file tree 3 files changed +24
-17
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable node/prefer-global/process */
2+ import type { LoaderFunction } from '@remix-run/node'
3+ import { redirect } from '@remix-run/node'
4+
5+ export const loader : LoaderFunction = async ( ) => {
6+ return redirect ( `${ process . env . NODE_ENV === 'development' ? process . env . CUHACKING_2025_PORTAL_LOCAL_URL : process . env . CUHACKING_2025_PORTAL_PUBLIC_URL } ` )
7+ }
8+
9+ export default function AuthRedirect ( ) {
10+ return null
11+ }
Original file line number Diff line number Diff line change 1- /* eslint-disable unused-imports/no-unused-vars */
1+ /* eslint-disable node/prefer-global/process */
22import type { LoaderFunction } from '@remix-run/node'
33import { Login as LoginPage } from '@cuhacking/portal/pages/login'
44import { redirect } from '@remix-run/node'
@@ -7,18 +7,23 @@ export const loader: LoaderFunction = async ({ request }) => {
77 const cookie = request . headers . get ( 'Cookie' )
88
99 try {
10- const res = await fetch ( 'http://localhost:8000/ api/users/me' , {
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` , {
1111 headers : { Cookie : cookie || '' } ,
1212 } )
1313
14- if ( res . ok ) {
14+ if ( ! res . ok ) {
15+ return null
16+ }
17+
18+ const data = await res . json ( )
19+
20+ if ( data ?. user ) {
1521 return redirect ( '/dashboard' )
1622 }
1723 }
1824 catch ( error ) {
19- // If error, show login page
25+ console . error ( 'Error fetching user:' , error )
2026 }
21-
2227 return null
2328}
2429
Original file line number Diff line number Diff line change @@ -2,12 +2,9 @@ import linkedinBlack from '@cuhacking/shared/assets/icons/socials/linkedin-black
22import { Button } from '@cuhacking/shared/ui/button'
33import { GlassmorphicCard } from '@cuhacking/shared/ui/glassmorphic-card'
44import { Typography } from '@cuhacking/shared/ui/typography'
5- import { Form , useNavigation } from '@remix-run/react'
6- import { signIn } from '../../../pages/login/index'
5+ import { Form } from '@remix-run/react'
76
87export function LoginCallToAction ( ) {
9- const transition = useNavigation ( )
10-
118 return (
129 < GlassmorphicCard
1310 className = "w-full flex flex-col items-center gap-5 p-3 md:gap-6 md:px-14 md:py-8 lg:gap-8 lg:px-20 lg:py-10"
@@ -23,18 +20,12 @@ export function LoginCallToAction() {
2320 </ h2 >
2421 </ header >
2522
26- < Form method = "post " >
23+ < Form method = "get" action = "/api/auth ">
2724 < Button
25+ type = "submit"
2826 variant = "primary"
2927 className = "flex items-center gap-x-3 px-4 md:px-6 lg:px-8 py-4"
3028 aria-label = "Login with Linkedin"
31- disabled = { transition . state === 'submitting' }
32- onClick = { async ( ) => {
33- await signIn . social ( {
34- provider : 'linkedin' ,
35- callbackURL : '/hello' ,
36- } )
37- } }
3829 >
3930 < img src = { linkedinBlack } alt = "Linkedin logo" className = "size-5" />
4031 < Typography variant = "h6" > Log In</ Typography >
You can’t perform that action at this time.
0 commit comments