Skip to content

Commit

Permalink
fix api arg
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jun 14, 2024
1 parent c3d54de commit d80788b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/api/sso.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -50,7 +55,7 @@ const ssoApi = api.injectEndpoints({
autoLoginAsStudent: build.mutation<
SessionMetadata,
{
user_id: User["id"]
student_id: Student["id"]
auto_gen_password: string
}
>({
Expand Down
4 changes: 2 additions & 2 deletions src/pages/login/studentForms/Class.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const Class: FC<ClassProps> = () => {
const searchParams = tryValidateSync(

Check warning on line 22 in src/pages/login/studentForms/Class.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/login/studentForms/Class.tsx#L22

Added line #L22 was not covered by tests
useSearchParamEntries(),
yup.object({
userId: yup.number().required(),
id: yup.number().required(),
agp: yup.string().required(),
}),
)

useEffect(() => {

Check warning on line 30 in src/pages/login/studentForms/Class.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/login/studentForms/Class.tsx#L30

Added line #L30 was not covered by tests
if (searchParams) {
autoLoginAsStudent({

Check warning on line 32 in src/pages/login/studentForms/Class.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/login/studentForms/Class.tsx#L32

Added line #L32 was not covered by tests
user_id: searchParams.userId,
student_id: searchParams.id,
auto_gen_password: searchParams.agp,
})
.unwrap()
Expand Down

0 comments on commit d80788b

Please sign in to comment.