From bcedbbc8b3aefbc511dfe3a1fc8b0238b93fb567 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Thu, 25 May 2023 19:01:37 -0700 Subject: error for custom feed when it is not valid or offlien --- src/state/models/feeds/posts.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/state/models/feeds/posts.ts') diff --git a/src/state/models/feeds/posts.ts b/src/state/models/feeds/posts.ts index 02ef5f38b..911cc6309 100644 --- a/src/state/models/feeds/posts.ts +++ b/src/state/models/feeds/posts.ts @@ -436,6 +436,9 @@ export class PostsFeedModel { } else if (this.feedType === 'home') { return this.rootStore.agent.getTimeline(params as GetTimeline.QueryParams) } else if (this.feedType === 'custom') { + this.checkIfCustomFeedIsOnlineAndValid( + params as GetCustomFeed.QueryParams, + ) return this.rootStore.agent.app.bsky.feed.getFeed( params as GetCustomFeed.QueryParams, ) @@ -445,4 +448,18 @@ export class PostsFeedModel { ) } } + + private async checkIfCustomFeedIsOnlineAndValid( + params: GetCustomFeed.QueryParams, + ) { + const res = await this.rootStore.agent.app.bsky.feed.getFeedGenerator({ + feed: params.feed, + }) + if (!res.data.isOnline || !res.data.isValid) { + runInAction(() => { + this.error = + 'This custom feed is not online or may be experiencing issues.' + }) + } + } } -- cgit 1.4.1