diff --git a/src/components/home/feeds/Feed.astro b/src/components/home/feeds/Feed.astro index 86ff60c..69fcfd3 100644 --- a/src/components/home/feeds/Feed.astro +++ b/src/components/home/feeds/Feed.astro @@ -6,48 +6,46 @@ import { AppBskyFeedPost } from "@atcute/bluesky"; import Post from "./Post.astro"; import type { Author } from "./post-types"; import { client } from "./atproto"; +import type { XRPCErrorPayload } from "@atcute/client"; const { ok, data } = await client.get("app.bsky.feed.getAuthorFeed", { params: { actor: socials.atproto.did, limit: 100, - filter: "posts_no_replies" + filter: "posts_no_replies", }, }); -if (!ok) { - // error occoured - console.error(data.error, data.message); - - return "Error 500: Internal server error fetching this feed. Try refreshing the page"; -} - -let posts: { - record: AppBskyFeedPost.Main; - author: Author; - uri: ResourceUri; -}[] = data.feed - // make sure it was by me (exclude reposts) - .filter((x) => x.post.author.did === socials.atproto.did) - // makes sure its not a reply - .filter((x) => !x.reply) - // this list now includes original posts & quote skeets - .map((x) => { - return { - record: is(AppBskyFeedPost.mainSchema, x.post.record) - ? x.post.record - : // never type bc it gets filtered out - (undefined as never), - author: { - did: x.post.author.did, - displayName: x.post.author.displayName, - handle: x.post.author.handle, - avatar: x.post.author.avatar, - }, - uri: x.post.uri, - }; - }) - .filter((x) => x.record); +const posts: + | { + record: AppBskyFeedPost.Main; + author: Author; + uri: ResourceUri; + }[] + | undefined = ok + ? data.feed + // make sure it was by me (exclude reposts) + .filter((x) => x.post.author.did === socials.atproto.did) + // makes sure its not a reply + .filter((x) => !x.reply) + // this list now includes original posts & quote skeets + .map((x) => { + return { + record: is(AppBskyFeedPost.mainSchema, x.post.record) + ? x.post.record + : // never type bc it gets filtered out + (undefined as never), + author: { + did: x.post.author.did, + displayName: x.post.author.displayName, + handle: x.post.author.handle, + avatar: x.post.author.avatar, + }, + uri: x.post.uri, + }; + }) + .filter((x) => x.record) + : undefined; ---
@@ -55,19 +53,35 @@ let posts: {

Bluesky 🦋

diff --git a/src/components/home/playing/TopSongs.astro b/src/components/home/playing/TopSongs.astro index 8cebbd1..0d4569d 100644 --- a/src/components/home/playing/TopSongs.astro +++ b/src/components/home/playing/TopSongs.astro @@ -26,7 +26,8 @@ const topSongs = await sdk.currentUser .then((tracks) => (!tracks ? throws("Top tracks failed") : tracks)) .catch((err) => console.error(err)); -if (!topSongs) return "Error 500 failed to get top songs!!"; +if (!topSongs) + return "Error: Failed to load top songs. Spotify refresh token may have expired or spotify may be down."; ---