From dd5c59afa8438ee9f014b547d263962221732913 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Thu, 29 May 2025 14:57:20 +0200 Subject: [PATCH] feat: handle agree ('allow') button click to select account for oauth auth --- web/src/pages/Authorize/index.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web/src/pages/Authorize/index.tsx b/web/src/pages/Authorize/index.tsx index c0b80f6..95f6b7b 100644 --- a/web/src/pages/Authorize/index.tsx +++ b/web/src/pages/Authorize/index.tsx @@ -1,13 +1,24 @@ -import { type FC } from "react"; +import { useCallback, type FC } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { ArrowLeftRight, ChevronDown } from "lucide-react"; import { Button } from "@/components/ui/button"; import Avatar from "@/feature/Avatar"; import { useAuth } from "@/store/auth"; +import { useOAuthContext } from "@/context/oauth"; const AuthorizePage: FC = () => { const promptAccountSelection = useAuth((state) => state.deleteActiveAccount); + const activeAccount = useAuth((state) => state.activeAccount); + + const oauth = useOAuthContext(); + + const profile = useAuth((state) => state.profile); + + const handleAgree = useCallback(() => { + if (!activeAccount) return; + oauth.selectSession(activeAccount.access); + }, [activeAccount, oauth]); return (
{

- qwer.009771@gmail.com + {profile?.email}

- +