import { User } from "@app/auth/components/user"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { setToArray } from "@utils/transform"; import { useContext, useState } from "react"; import { navigate } from "vite-plugin-ssr/client/router"; export function Page() { const ndk = useContext(RelayContext); const [loading, setLoading] = useState(false); const [account, updateFollows] = useActiveAccount((state: any) => [ state.account, state.updateFollows, ]); const submit = async () => { // show loading indicator setLoading(true); try { const user = ndk.getUser({ hexpubkey: account.pubkey }); const follows = await user.follows(); // follows as list const followsList = setToArray(follows); // update account follows in store updateFollows(followsList); // redirect to home setTimeout( () => navigate("/", { overwriteLastHistoryEntry: true }), 2000, ); } catch { console.log("error"); } }; return (