-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FF-16 collections view mark subscribed feeds (#265)
- Loading branch information
Showing
10 changed files
with
85 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {computed, ref, watch} from "vue"; | ||
import {useRouter} from "vue-router"; | ||
import {defineStore} from "pinia"; | ||
|
||
import type * as t from "@/logic/types"; | ||
import * as e from "@/logic/enums"; | ||
import * as api from "@/logic/api"; | ||
import {Timer} from "@/logic/timer"; | ||
import {computedAsync} from "@vueuse/core"; | ||
import {useGlobalSettingsStore} from "@/stores/globalSettings"; | ||
|
||
export const useFeedsStore = defineStore("feedsStore", () => { | ||
const globalSettings = useGlobalSettingsStore(); | ||
|
||
const feeds = computedAsync(async () => { | ||
// force refresh | ||
globalSettings.dataVersion; | ||
|
||
const feedsList = await api.getFeeds(); | ||
|
||
const feedsDict: {[key: t.FeedId]: t.Feed} = {}; | ||
|
||
for (const feed of feedsList) { | ||
feedsDict[feed.id] = feed; | ||
} | ||
|
||
return feedsDict; | ||
}, {}); | ||
|
||
async function unsubscribe(feedId: t.FeedId) { | ||
await api.unsubscribe({feedId: feedId}); | ||
globalSettings.updateDataVersion(); | ||
} | ||
|
||
async function subscribe(url: t.URL) { | ||
await api.addFeed({ | ||
url: url | ||
}); | ||
|
||
globalSettings.updateDataVersion(); | ||
} | ||
|
||
return { | ||
feeds, | ||
unsubscribe, | ||
subscribe | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters