From 44592ebc08c0399f6d922508075fef4475d1156f Mon Sep 17 00:00:00 2001 From: LandaMm Date: Sat, 7 Jun 2025 19:47:12 +0200 Subject: [PATCH] feat: show api service's information --- web/src/pages/Authorize/index.tsx | 66 +++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/web/src/pages/Authorize/index.tsx b/web/src/pages/Authorize/index.tsx index 1dcf7bf..fe4b9cd 100644 --- a/web/src/pages/Authorize/index.tsx +++ b/web/src/pages/Authorize/index.tsx @@ -1,7 +1,7 @@ -import { useCallback, type FC } from "react"; +import { useCallback, useEffect, type FC } from "react"; import { Card, CardContent } from "@/components/ui/card"; -import { ArrowLeftRight, ChevronDown } from "lucide-react"; +import { ArrowLeftRight, ChevronDown, LayoutDashboard } from "lucide-react"; import { Button } from "@/components/ui/button"; import Avatar from "@/feature/Avatar"; import { useAuth } from "@/store/auth"; @@ -13,6 +13,12 @@ const AuthorizePage: FC = () => { const profile = useAuth((state) => state.profile); + const fetchService = useOAuth((s) => s.fetchApiService); + const fetching = useOAuth((s) => s.fetching); + const clientId = useOAuth((s) => s.clientID); + + const apiService = useOAuth((s) => s.apiService); + const selectSession = useOAuth((state) => state.selectSession); const handleAgree = useCallback(() => { @@ -20,12 +26,44 @@ const AuthorizePage: FC = () => { selectSession(activeAccount.access); }, [activeAccount, selectSession]); + useEffect(() => { + if (clientId) { + fetchService(); + } + }, [clientId, fetchService]); + return (
- + + {fetching && ( +
+ + Loading... +
+ )}
{/* {
-
+
{/* */} - + {apiService?.icon_url ? ( + service_icon + ) : ( + + )}

- MDN Lab Services + {apiService?.name ?? "Service"} {" "} wants to access your Home Account

@@ -73,7 +116,7 @@ const AuthorizePage: FC = () => {

This will allow{" "} - MDN Lab Services + {apiService?.name ?? "service"} {" "} to:

@@ -99,7 +142,8 @@ const AuthorizePage: FC = () => {

- Are you sure you want to trust MDN Lab Services? + Are you sure you want to trust {apiService?.name ?? "service"} + ?

Please do not share any sensitive, personal, or unnecessary