From 31b1cacb193421810bf42e28056161e75574207a Mon Sep 17 00:00:00 2001 From: tomholford Date: Wed, 14 Jun 2023 01:50:50 -0700 Subject: [PATCH] wip: use passport --- ui/src/permissions/PermissionsDialog.tsx | 3 ++- ui/src/permissions/usePassport.ts | 15 +++++++++------ ui/src/permissions/usePermissions.ts | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/src/permissions/PermissionsDialog.tsx b/ui/src/permissions/PermissionsDialog.tsx index 43ade6aa..bc311470 100644 --- a/ui/src/permissions/PermissionsDialog.tsx +++ b/ui/src/permissions/PermissionsDialog.tsx @@ -55,7 +55,8 @@ export function PermissionsDialogInner({ viewMode === 'Summary' ? (
{ - [...passport.sys, ...passport.any, ...passport.new, ...passport.rad].map(p => { + // [...passport.sys, ...passport.any, ...passport.new, ...passport.rad].map(p => { + [...passport.rad].map(p => { return p.kind.pes.map((pe, i) => { return }) diff --git a/ui/src/permissions/usePassport.ts b/ui/src/permissions/usePassport.ts index c3d8c64a..4a090b06 100644 --- a/ui/src/permissions/usePassport.ts +++ b/ui/src/permissions/usePassport.ts @@ -1,14 +1,17 @@ -import { Passport } from "@/gear"; +import { Passport, Seal, sealToPassport } from "@/gear"; import { useEffect, useState } from "react"; -import { fakePassport } from './temp'; -export default function usePassport() { +export default function usePassport({ seal }: { seal: Seal }) { const [passport, setPassport] = useState(null); + const fetchPassport = async () => { + const response = await sealToPassport(seal); + console.log('response', response); + setPassport(response); + }; + useEffect(() => { - setTimeout(() => { - setPassport(fakePassport); - } , 2000); + fetchPassport(); }, []); return { passport }; diff --git a/ui/src/permissions/usePermissions.ts b/ui/src/permissions/usePermissions.ts index cf35c938..03c644f0 100644 --- a/ui/src/permissions/usePermissions.ts +++ b/ui/src/permissions/usePermissions.ts @@ -14,7 +14,7 @@ export default function usePermissions() { const treaty = useTreaty(host, desk); const docket = charge || treaty; const appName = getAppName(docket); - const { passport } = usePassport(); // TODO: pass in desk + const { passport } = usePassport({ seal: treaty?.seal }); const [ship,] = useRemoteDesk(docket, pike, treaty?.ship); const installStatus = useInstallStatus(docket); const [presentableSeal, setPresentableSeal] = useState(null);