summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDevlin Junker <devlin.junker@gmail.com>2022-11-30 21:20:03 -1000
committerBenjamin Brahmer <info@b-brahmer.de>2022-12-06 14:57:20 +0100
commit8131604192d06ecbf8f19a039a3f497d5e12918e (patch)
tree8f27dd07ceba9f1b0863da6f3d67dbdce573632d /src
parentf65769868bb826d4525025e92ab329f03f1c4962 (diff)
lint the .ts and spec.ts files also
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/store/feed.ts120
-rw-r--r--src/store/folder.ts117
-rw-r--r--src/store/index.ts27
-rw-r--r--src/types/Feed.ts1
-rw-r--r--src/types/Folder.ts1
5 files changed, 130 insertions, 136 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,
+}
diff --git a/src/store/folder.ts b/src/store/folder.ts
index c7ae93341..3a46e755b 100644
--- a/src/store/folder.ts
+++ b/src/store/folder.ts
@@ -1,87 +1,86 @@
-import axios from "@nextcloud/axios";
-import { generateUrl } from "@nextcloud/router";
+import axios from '@nextcloud/axios'
+import { generateUrl } from '@nextcloud/router'
-import { AppState, ActionParams } from 'src/store'
+import { AppState, ActionParams } from '../store'
import { Folder } from '../types/Folder'
export const FOLDER_MUTATION_TYPES = {
- SET_FOLDERS: 'SET_FOLDERS',
- DELETE_FOLDER: 'DELETE_FOLDER'
+ SET_FOLDERS: 'SET_FOLDERS',
+ DELETE_FOLDER: 'DELETE_FOLDER',
}
export const FOLDER_ACTION_TYPES = {
- FETCH_FOLDERS: 'FETCH_FOLDERS',
- ADD_FOLDERS: 'ADD_FOLDER',
- DELETE_FOLDER: 'DELETE_FOLDER'
+ FETCH_FOLDERS: 'FETCH_FOLDERS',
+ ADD_FOLDERS: 'ADD_FOLDER',
+ DELETE_FOLDER: 'DELETE_FOLDER',
}
const state = {
- folders: []
+ folders: [],
}
const getters = {
- folders (state: AppState) {
- return state.folders;
- },
+ folders(state: AppState) {
+ return state.folders
+ },
}
-const folderUrl = generateUrl("/apps/news/folders")
+const folderUrl = generateUrl('/apps/news/folders')
export const actions = {
- async [FOLDER_ACTION_TYPES.FETCH_FOLDERS] ({ commit }: ActionParams) {
- const folders = await axios.get(
- generateUrl("/apps/news/folders")
- );
+ async [FOLDER_ACTION_TYPES.FETCH_FOLDERS]({ commit }: ActionParams) {
+ const folders = await axios.get(
+ generateUrl('/apps/news/folders'),
+ )
- commit(FOLDER_MUTATION_TYPES.SET_FOLDERS, folders.data.folders);
- },
- [FOLDER_ACTION_TYPES.ADD_FOLDERS] ({ commit }: ActionParams, { folder }: { folder: Folder}) {
- console.log(folder)
- axios.post(folderUrl, {folderName: folder.name}).then(
- response => commit(FOLDER_MUTATION_TYPES.SET_FOLDERS, response.data.folders)
- );
- },
- [FOLDER_ACTION_TYPES.DELETE_FOLDER] ({ commit }: ActionParams, { folder }: { folder: Folder}) {
- /**
+ commit(FOLDER_MUTATION_TYPES.SET_FOLDERS, folders.data.folders)
+ },
+ [FOLDER_ACTION_TYPES.ADD_FOLDERS]({ commit }: ActionParams, { folder }: { folder: Folder}) {
+ console.log(folder)
+ axios.post(folderUrl, { folderName: folder.name }).then(
+ response => commit(FOLDER_MUTATION_TYPES.SET_FOLDERS, response.data.folders),
+ )
+ },
+ [FOLDER_ACTION_TYPES.DELETE_FOLDER]({ commit }: ActionParams, { folder }: { folder: Folder}) {
+ /**
this.getByFolderId(folderId).forEach(function (feed) {
promises.push(self.reversiblyDelete(feed.id, false, true));
});
this.updateUnreadCache();
- */
- axios.delete(folderUrl + '/' + folder.id).then(() => commit(FOLDER_MUTATION_TYPES.DELETE_FOLDER, folder))
- },
- // loadFolder({commit}) {
- // console.log('loading folders')
- // axios.get(folderUrl).then(
- // response => {
- // commit('addFolders', response.data.folders);
- // axios.get(feedUrl).then(
- // response => commit('addFeeds', response.data.feeds)
- // )
- // }
- // )
- // },
+ */
+ axios.delete(folderUrl + '/' + folder.id).then(() => commit(FOLDER_MUTATION_TYPES.DELETE_FOLDER, folder))
+ },
+ // loadFolder({commit}) {
+ // console.log('loading folders')
+ // axios.get(folderUrl).then(
+ // response => {
+ // commit('addFolders', response.data.folders);
+ // axios.get(feedUrl).then(
+ // response => commit('addFeeds', response.data.feeds)
+ // )
+ // }
+ // )
+ // },
}
-
export const mutations = {
- [FOLDER_MUTATION_TYPES.SET_FOLDERS] (state: AppState, folders: Folder[]) {
- console.log(folders);
- folders.forEach(it => {
- it.feedCount = 0
- it.feeds = []
- state.folders.push(it)
- })
- },
- [FOLDER_MUTATION_TYPES.DELETE_FOLDER] (state: AppState, folder: Folder) {
- const index = state.folders.indexOf(folder);
- state.folders.splice(index, 1);
- }
+ [FOLDER_MUTATION_TYPES.SET_FOLDERS](state: AppState, folders: Folder[]) {
+ console.log(folders)
+ folders.forEach(it => {
+ it.feedCount = 0
+ it.feeds = []
+ state.folders.push(it)
+ })
+ },
+ [FOLDER_MUTATION_TYPES.DELETE_FOLDER](state: AppState, folder: Folder) {
+ const index = state.folders.indexOf(folder)
+ state.folders.splice(index, 1)
+ },
}
export default {
- state,
- getters,
- actions,
- mutations
-} \ No newline at end of file
+ state,
+ getters,
+ actions,
+ mutations,
+}
diff --git a/src/store/index.ts b/src/store/index.ts
index 5d599449b..277bbfc2a 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,21 +1,19 @@
-import { Commit, Store } from "vuex";
-
import { Folder } from '../types/Folder'
import { Feed } from '../types/Feed'
-import feeds, { FEED_MUTATION_TYPES, FEED_ACTION_TYPES } from "./feed";
-import folders, { FOLDER_MUTATION_TYPES, FOLDER_ACTION_TYPES } from "./folder";
+import feeds, { FEED_MUTATION_TYPES, FEED_ACTION_TYPES } from './feed'
+import folders, { FOLDER_MUTATION_TYPES, FOLDER_ACTION_TYPES } from './folder'
export const MUTATIONS = {
- ... FEED_MUTATION_TYPES,
- ... FOLDER_MUTATION_TYPES
+ ...FEED_MUTATION_TYPES,
+ ...FOLDER_MUTATION_TYPES,
}
export const ACTIONS = {
- ... FEED_ACTION_TYPES,
- ... FOLDER_ACTION_TYPES
+ ...FEED_ACTION_TYPES,
+ ...FOLDER_ACTION_TYPES,
}
-export type ActionParams = { commit: Commit };
+export type ActionParams = { commit: any };
export type AppState = {
feeds: Feed[];
@@ -23,10 +21,9 @@ export type AppState = {
items: any[];
}
-
export default {
- modules: {
- feeds,
- folders
- }
-}; \ No newline at end of file
+ modules: {
+ feeds,
+ folders,
+ },
+}
diff --git a/src/types/Feed.ts b/src/types/Feed.ts
index d03ce5e0b..9e06aca3c 100644
--- a/src/types/Feed.ts
+++ b/src/types/Feed.ts
@@ -6,4 +6,3 @@ export type Feed = {
autoDiscover?: boolean;
faviconLink?: string;
}
-
diff --git a/src/types/Folder.ts b/src/types/Folder.ts
index 02b25cb8d..f09a404d4 100644
--- a/src/types/Folder.ts
+++ b/src/types/Folder.ts
@@ -5,4 +5,3 @@ export type Folder = {
name: string;
id: number;
}
-