Skip to content

Commit dcbd878

Browse files
committed
Merge branch 'main' of github.com:COMPFEST/furnace
2 parents 2c8c84f + baf70c0 commit dcbd878

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

app/routes/_page.main-event.walk-in-interview.register.$companyId.$slotId.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { redirect, type LoaderFunctionArgs } from 'react-router';
2-
import { getSession } from '~/lib/server/flash';
2+
import { fetchServer } from '~/lib/fetch.server';
33
import { RegisterQueueInterviewPage } from '~/modules/MainEventModule/MEWalkInInterviewPage/RegisterModule';
44

55
export async function loader(args: LoaderFunctionArgs) {
6-
const cookieHeader = args.request.headers.get('Cookie');
6+
const cookieHeader = args.request.headers.get('Cookie') || '';
77

8-
const session = await getSession(cookieHeader);
9-
const ticket = session.get('ticket');
8+
const loggedInUser = await fetchServer('/api/user', cookieHeader);
109

11-
console.log('Loader - ticket from session:', ticket);
10+
const currentPath = new URL(args.request.url).pathname;
11+
const ssoUrl =
12+
'https://sso.compfest.id/login?set_redirect_url=true&redirect_to=https://compfest.id';
13+
14+
if (!loggedInUser?.success) {
15+
return redirect(`${ssoUrl}${currentPath}`);
16+
}
1217

1318
return null;
1419
}

0 commit comments

Comments
 (0)