frontend client for gemstone. decentralised workplace app
1import type { Did } from "@/lib/types/atproto"; 2import { bskyClient } from "@/lib/utils/atproto/client"; 3 4export const getBskyProfile = async (did: Did) => { 5 const { ok, data } = await bskyClient.get("app.bsky.actor.getProfile", { 6 params: { 7 actor: did, 8 }, 9 }); 10 11 if (!ok) { 12 switch (data.error) { 13 case "InvalidRequest": { 14 console.error("There is no account at", did); 15 return; 16 } 17 case "AccountTakedown": { 18 console.error("Account of", did, "was taken down"); 19 return; 20 } 21 case "AccountDeactivated": { 22 console.error("Account of", did, "was deactivated"); 23 return; 24 } 25 default: { 26 console.error( 27 "Something went wrong fetching the profile of", 28 did, 29 ); 30 return; 31 } 32 } 33 } 34 35 return data; 36};