From d80788b974570d57f93423039c0224b476470b27 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 14 Jun 2024 10:02:43 +0000 Subject: [PATCH] fix api arg --- src/api/sso.ts | 9 +++++++-- src/pages/login/studentForms/Class.tsx | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/api/sso.ts b/src/api/sso.ts index 200f9cc..8ecd99d 100644 --- a/src/api/sso.ts +++ b/src/api/sso.ts @@ -1,6 +1,11 @@ // TODO: rename this file to session.ts and move to codeforlife-sso-frontend. -import { type Class, type OtpBypassToken, type User } from "codeforlife/api" +import { + type Class, + type OtpBypassToken, + type Student, + type User, +} from "codeforlife/api" import { type SessionMetadata } from "codeforlife/hooks" import { type Arg } from "codeforlife/utils/api" @@ -50,7 +55,7 @@ const ssoApi = api.injectEndpoints({ autoLoginAsStudent: build.mutation< SessionMetadata, { - user_id: User["id"] + student_id: Student["id"] auto_gen_password: string } >({ diff --git a/src/pages/login/studentForms/Class.tsx b/src/pages/login/studentForms/Class.tsx index 45982ca..30dec3f 100644 --- a/src/pages/login/studentForms/Class.tsx +++ b/src/pages/login/studentForms/Class.tsx @@ -22,7 +22,7 @@ const Class: FC = () => { const searchParams = tryValidateSync( useSearchParamEntries(), yup.object({ - userId: yup.number().required(), + id: yup.number().required(), agp: yup.string().required(), }), ) @@ -30,7 +30,7 @@ const Class: FC = () => { useEffect(() => { if (searchParams) { autoLoginAsStudent({ - user_id: searchParams.userId, + student_id: searchParams.id, auto_gen_password: searchParams.agp, }) .unwrap()