diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-25 19:01:37 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-25 19:01:37 -0700 |
commit | bcedbbc8b3aefbc511dfe3a1fc8b0238b93fb567 (patch) | |
tree | e2e6a08dbe95e3b2cba879ef1b96a4bb9e15a483 /src | |
parent | 11262ffc83be69f149c2a5fe176fcb8a8588c014 (diff) | |
download | voidsky-bcedbbc8b3aefbc511dfe3a1fc8b0238b93fb567.tar.zst |
error for custom feed when it is not valid or offlien
Diffstat (limited to 'src')
-rw-r--r-- | src/state/models/feeds/posts.ts | 17 |
1 files changed, 17 insertions, 0 deletions
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.' + }) + } + } } |