chore: cleanup

This commit is contained in:
2023-11-01 00:40:12 +09:00
parent 8f90daa840
commit c65bb7a992
56 changed files with 344 additions and 221 deletions

View File

@ -4,9 +4,11 @@ import { HexKey } from "@snort/system";
import FollowListBase from "Element/User/FollowListBase";
import PageSpinner from "Element/PageSpinner";
import NostrBandApi from "External/NostrBand";
import { ErrorOrOffline } from "./ErrorOrOffline";
export default function TrendingUsers() {
const [userList, setUserList] = useState<HexKey[]>();
const [error, setError] = useState<Error>();
async function loadTrendingUsers() {
const api = new NostrBandApi();
@ -16,9 +18,14 @@ export default function TrendingUsers() {
}
useEffect(() => {
loadTrendingUsers().catch(console.error);
loadTrendingUsers().catch(e => {
if (e instanceof Error) {
setError(e);
}
});
}, []);
if (error) return <ErrorOrOffline error={error} onRetry={loadTrendingUsers} className="p" />;
if (!userList) return <PageSpinner />;
return <FollowListBase pubkeys={userList} showAbout={true} />;