import { Component, Match, Show, Switch, createResource } from "solid-js"; import { Client } from "@atcute/client"; import { agent } from "./login"; type MiniProfileProps = { did: `did:${string}:${string}`; }; async function getProfileDetails(did: `did:${string}:${string}`) { const rpc = new Client({ handler: agent }); const res = await rpc.get("app.bsky.actor.getProfile", { params: { actor: did, }, }); if (!res.ok) { throw new Error(`Failed to fetch profile details: ${res.status}`); } return res.data; } const MiniProfile = (props: MiniProfileProps) => { const [profileInfo] = createResource(agent.sub, getProfileDetails); return ( <>

loading...

Error: {profileInfo.error.message}

{`Profile

{profileInfo()?.displayName}

@{profileInfo()?.handle}

); }; export default MiniProfile;