diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-05-18 14:39:04 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-05-18 14:39:04 -0500 |
commit | 5537d19e555c39f5f9a0ec16735ea4c3860357c4 (patch) | |
tree | 35b22f36a6703caefef3c63ca82678ee1d53c2d4 /src/state/models/feeds | |
parent | acea0e074d75ac549abb01dc4ac16573a43ad7fa (diff) | |
download | voidsky-5537d19e555c39f5f9a0ec16735ea4c3860357c4.tar.zst |
Update saved feeds to use preferences
Diffstat (limited to 'src/state/models/feeds')
-rw-r--r-- | src/state/models/feeds/custom-feed.ts | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/state/models/feeds/custom-feed.ts b/src/state/models/feeds/custom-feed.ts index 5e550ec69..e457d2d1e 100644 --- a/src/state/models/feeds/custom-feed.ts +++ b/src/state/models/feeds/custom-feed.ts @@ -38,7 +38,7 @@ export class CustomFeedModel { } get isSaved() { - return this.data.viewer?.saved + return this.rootStore.preferences.savedFeeds.includes(this.uri) } get isLiked() { @@ -49,23 +49,11 @@ export class CustomFeedModel { // = async save() { - await this.rootStore.agent.app.bsky.feed.saveFeed({ - feed: this.uri, - }) - runInAction(() => { - this.data.viewer = this.data.viewer || {} - this.data.viewer.saved = true - }) + await this.rootStore.preferences.addSavedFeed(this.uri) } async unsave() { - await this.rootStore.agent.app.bsky.feed.unsaveFeed({ - feed: this.uri, - }) - runInAction(() => { - this.data.viewer = this.data.viewer || {} - this.data.viewer.saved = false - }) + await this.rootStore.preferences.removeSavedFeed(this.uri) } async like() { @@ -82,7 +70,7 @@ export class CustomFeedModel { } async unlike() { - if (!this.data.viewer.like) { + if (!this.data.viewer?.like) { return } try { |