From 476b9a13d90e6a90235408dbd12b8bf235880838 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Sun, 25 May 2025 14:54:19 +0200 Subject: [PATCH] feat: handle session selection after logging in --- web/src/pages/Login/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/pages/Login/index.tsx b/web/src/pages/Login/index.tsx index 1db8b52..fbd8ea5 100644 --- a/web/src/pages/Login/index.tsx +++ b/web/src/pages/Login/index.tsx @@ -9,6 +9,7 @@ import { useForm, type SubmitHandler } from "react-hook-form"; import { useCallback, useState } from "react"; import { loginApi } from "@/api/login"; import { useAccountRepo } from "@/repository/account"; +import { useOAuthContext } from "@/context/oauth"; interface LoginForm { email: string; @@ -27,6 +28,8 @@ export default function LoginPage() { const [error, setError] = useState(""); const [success, setSuccess] = useState(""); + const oauth = useOAuthContext(); + const repo = useAccountRepo(); const onSubmit: SubmitHandler = useCallback( @@ -56,6 +59,8 @@ export default function LoginPage() { setSuccess("You have successfully logged in"); reset(); + + oauth.selectSession(response.access); } catch (err: any) { console.log(err); setError( @@ -66,7 +71,7 @@ export default function LoginPage() { setLoading(false); } }, - [repo, reset] + [oauth, repo, reset] ); return (