diff options
author | Devlin Junker <devlin.junker@gmail.com> | 2022-11-30 21:20:03 -1000 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-12-06 14:57:20 +0100 |
commit | 8131604192d06ecbf8f19a039a3f497d5e12918e (patch) | |
tree | 8f27dd07ceba9f1b0863da6f3d67dbdce573632d /src/store/feed.ts | |
parent | f65769868bb826d4525025e92ab329f03f1c4962 (diff) |
lint the .ts and spec.ts files also
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'src/store/feed.ts')
-rw-r--r-- | src/store/feed.ts | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/store/feed.ts b/src/store/feed.ts index 4269879f9..a74b7c9e4 100644 --- a/src/store/feed.ts +++ b/src/store/feed.ts @@ -1,91 +1,91 @@ -import axios from "@nextcloud/axios"; -import { generateUrl } from "@nextcloud/router"; +import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' -import { ActionParams, AppState } from 'src/store' +import { ActionParams, AppState } from '../store' import { Feed } from '../types/Feed' export const FEED_MUTATION_TYPES = { - SET_FEEDS: 'SET_FEEDS', + SET_FEEDS: 'SET_FEEDS', } export const FEED_ACTION_TYPES = { - ADD_FEED: 'ADD_FEED', - FETCH_FEEDS: 'FETCH_FEEDS', + ADD_FEED: 'ADD_FEED', + FETCH_FEEDS: 'FETCH_FEEDS', } const state = { - feeds: [] + feeds: [], } const getters = { - feeds (state: AppState) { - return state.feeds; - }, + feeds(state: AppState) { + return state.feeds + }, } -const feedUrl = generateUrl("/apps/news/feeds") +const feedUrl = generateUrl('/apps/news/feeds') export const actions = { - async [FEED_ACTION_TYPES.FETCH_FEEDS] ({ commit }: ActionParams) { - const feeds = await axios.get( - generateUrl("/apps/news/feeds") - ); + async [FEED_ACTION_TYPES.FETCH_FEEDS]({ commit }: ActionParams) { + const feeds = await axios.get( + generateUrl('/apps/news/feeds'), + ) - commit(FEED_MUTATION_TYPES.SET_FEEDS, feeds.data.feeds); - }, - [FEED_ACTION_TYPES.ADD_FEED] ({ commit }: ActionParams, { feedReq }: { feedReq: { url: string; folder?: { id: number } } }) { - console.log(feedReq) - let url = feedReq.url.trim(); - if (!url.startsWith('http')) { - url = 'https://' + url; - } + commit(FEED_MUTATION_TYPES.SET_FEEDS, feeds.data.feeds) + }, + [FEED_ACTION_TYPES.ADD_FEED]({ commit }: ActionParams, { feedReq }: { feedReq: { url: string; folder?: { id: number } } }) { + console.log(feedReq) + let url = feedReq.url.trim() + if (!url.startsWith('http')) { + url = 'https://' + url + } - /** + /** if (title !== undefined) { title = title.trim(); } - */ + */ - let feed: Feed = { - url: url, - folderId: feedReq.folder?.id || 0, - title: undefined, - unreadCount: 0, - autoDiscover: undefined // TODO - }; + const feed: Feed = { + url, + folderId: feedReq.folder?.id || 0, + title: undefined, + unreadCount: 0, + autoDiscover: undefined, // TODO + } - // this.add(feed); - // this.updateFolderCache(); + // this.add(feed); + // this.updateFolderCache(); - axios.post(feedUrl, { - url: feed.url, - parentFolderId: feed.folderId, - title: null, - user: null, - password: null, - fullDiscover: feed.autoDiscover - }).then(() => { - commit('addFeed', feed) - }); - } + axios.post(feedUrl, { + url: feed.url, + parentFolderId: feed.folderId, + title: null, + user: null, + password: null, + fullDiscover: feed.autoDiscover, + }).then(() => { + commit('addFeed', feed) + }) + }, } export const mutations = { - [FEED_MUTATION_TYPES.SET_FEEDS] (state: AppState, feeds: Feed[]) { - feeds.forEach(it => { - state.feeds.push(it) - const folder = state.folders.find(folder => folder.id === it.folderId) - if (folder) { - folder.feeds.push(it) - folder.feedCount += it.unreadCount - } - }) - }, + [FEED_MUTATION_TYPES.SET_FEEDS](state: AppState, feeds: Feed[]) { + feeds.forEach(it => { + state.feeds.push(it) + const folder = state.folders.find(folder => folder.id === it.folderId) + if (folder) { + folder.feeds.push(it) + folder.feedCount += it.unreadCount + } + }) + }, } export default { - state, - getters, - actions, - mutations -}
\ No newline at end of file + state, + getters, + actions, + mutations, +} |