Skip to content

Commit

Permalink
wip: use passport
Browse files Browse the repository at this point in the history
  • Loading branch information
tomholford committed Jun 14, 2023
1 parent e32ee27 commit 31b1cac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ui/src/permissions/PermissionsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export function PermissionsDialogInner({
viewMode === 'Summary' ? (
<div className="space-y-5">
{
[...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 <SummaryRow key={i} summary={pe} />
})
Expand Down
15 changes: 9 additions & 6 deletions ui/src/permissions/usePassport.ts
Original file line number Diff line number Diff line change
@@ -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<Passport | null>(null);

const fetchPassport = async () => {
const response = await sealToPassport(seal);
console.log('response', response);
setPassport(response);
};

useEffect(() => {
setTimeout(() => {
setPassport(fakePassport);
} , 2000);
fetchPassport();
}, []);

return { passport };
Expand Down
2 changes: 1 addition & 1 deletion ui/src/permissions/usePermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[] | null>(null);
Expand Down

0 comments on commit 31b1cac

Please sign in to comment.