aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/api.js10
-rw-r--r--src/modules/chat.js4
-rw-r--r--src/modules/config.js4
-rw-r--r--src/modules/errors.js1
-rw-r--r--src/modules/instance.js2
-rw-r--r--src/modules/oauth_tokens.js4
-rw-r--r--src/modules/statuses.js8
-rw-r--r--src/modules/users.js24
8 files changed, 28 insertions, 29 deletions
diff --git a/src/modules/api.js b/src/modules/api.js
index 31cb55c6..582e4fe7 100644
--- a/src/modules/api.js
+++ b/src/modules/api.js
@@ -13,10 +13,10 @@ const api = {
setBackendInteractor (state, backendInteractor) {
state.backendInteractor = backendInteractor
},
- addFetcher (state, {timeline, fetcher}) {
+ addFetcher (state, { timeline, fetcher }) {
state.fetchers[timeline] = fetcher
},
- removeFetcher (state, {timeline}) {
+ removeFetcher (state, { timeline }) {
delete state.fetchers[timeline]
},
setWsToken (state, token) {
@@ -33,7 +33,7 @@ const api = {
}
},
actions: {
- startFetching (store, {timeline = 'friends', tag = false, userId = false}) {
+ startFetching (store, { timeline = 'friends', tag = false, userId = false }) {
// Don't start fetching if we already are.
if (store.state.fetchers[timeline]) return
@@ -43,7 +43,7 @@ const api = {
stopFetching (store, timeline) {
const fetcher = store.state.fetchers[timeline]
window.clearInterval(fetcher)
- store.commit('removeFetcher', {timeline})
+ store.commit('removeFetcher', { timeline })
},
setWsToken (store, token) {
store.commit('setWsToken', token)
@@ -52,7 +52,7 @@ const api = {
// Set up websocket connection
if (!store.state.chatDisabled) {
const token = store.state.wsToken
- const socket = new Socket('/socket', {params: {token}})
+ const socket = new Socket('/socket', { params: { token } })
socket.connect()
store.dispatch('initializeChat', socket)
}
diff --git a/src/modules/chat.js b/src/modules/chat.js
index 2804e577..0bc2c691 100644
--- a/src/modules/chat.js
+++ b/src/modules/chat.js
@@ -1,7 +1,7 @@
const chat = {
state: {
messages: [],
- channel: {state: ''},
+ channel: { state: '' },
socket: null
},
mutations: {
@@ -29,7 +29,7 @@ const chat = {
channel.on('new_msg', (msg) => {
store.commit('addMessage', msg)
})
- channel.on('messages', ({messages}) => {
+ channel.on('messages', ({ messages }) => {
store.commit('setMessages', messages)
})
channel.join()
diff --git a/src/modules/config.js b/src/modules/config.js
index 1666a2c5..c1ddd630 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -54,10 +54,10 @@ const config = {
},
actions: {
setHighlight ({ commit, dispatch }, { user, color, type }) {
- commit('setHighlight', {user, color, type})
+ commit('setHighlight', { user, color, type })
},
setOption ({ commit, dispatch }, { name, value }) {
- commit('setOption', {name, value})
+ commit('setOption', { name, value })
switch (name) {
case 'theme':
setPreset(value, commit)
diff --git a/src/modules/errors.js b/src/modules/errors.js
index c809e1b5..ca89dc0f 100644
--- a/src/modules/errors.js
+++ b/src/modules/errors.js
@@ -9,4 +9,3 @@ export function humanizeErrors (errors) {
return [...errs, message]
}, [])
}
-
diff --git a/src/modules/instance.js b/src/modules/instance.js
index d4185f6a..debf7165 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -68,7 +68,7 @@ const instance = {
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
- commit('setInstanceOption', {name, value})
+ commit('setInstanceOption', { name, value })
switch (name) {
case 'name':
dispatch('setPageTitle')
diff --git a/src/modules/oauth_tokens.js b/src/modules/oauth_tokens.js
index 00ac1431..0159a3f1 100644
--- a/src/modules/oauth_tokens.js
+++ b/src/modules/oauth_tokens.js
@@ -3,12 +3,12 @@ const oauthTokens = {
tokens: []
},
actions: {
- fetchTokens ({rootState, commit}) {
+ fetchTokens ({ rootState, commit }) {
rootState.api.backendInteractor.fetchOAuthTokens().then((tokens) => {
commit('swapTokens', tokens)
})
},
- revokeToken ({rootState, commit, state}, id) {
+ revokeToken ({ rootState, commit, state }, id) {
rootState.api.backendInteractor.revokeOAuthToken(id).then((response) => {
if (response.status === 201) {
commit('swapTokens', state.tokens.filter(token => token.id !== id))
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 8e0203e3..209afc0f 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -78,13 +78,13 @@ const mergeOrAdd = (arr, obj, item) => {
merge(oldItem, omitBy(item, (v, k) => v === null || k === 'user'))
// Reactivity fix.
oldItem.attachments.splice(oldItem.attachments.length)
- return {item: oldItem, new: false}
+ return { item: oldItem, new: false }
} else {
// This is a new item, prepare it
prepareStatus(item)
arr.push(item)
set(obj, item.id, item)
- return {item, new: true}
+ return { item, new: true }
}
}
@@ -237,12 +237,12 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
const uri = deletion.uri
// Remove possible notification
- const status = find(allStatuses, {uri})
+ const status = find(allStatuses, { uri })
if (!status) {
return
}
- remove(state.notifications.data, ({action: {id}}) => id === status.id)
+ remove(state.notifications.data, ({ action: { id } }) => id === status.id)
remove(allStatuses, { uri })
if (timeline) {
diff --git a/src/modules/users.js b/src/modules/users.js
index 1a507d31..e1eba5e6 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -224,8 +224,8 @@ const users = {
.then((friends) => {
commit('addFriends', { id: user.id, friends })
resolve(friends)
- }).catch(() => {
- reject()
+ }).catch(e => {
+ reject(e)
})
})
},
@@ -279,8 +279,8 @@ const users = {
const notificationsObject = store.rootState.statuses.notifications.idStore
const relevantNotifications = Object.entries(notificationsObject)
- .filter(([k, val]) => notificationIds.includes(k))
- .map(([k, val]) => val)
+ .filter(([k, val]) => notificationIds.includes(k))
+ .map(([k, val]) => val)
// Reconnect users to notifications
each(relevantNotifications, (notification) => {
@@ -322,7 +322,7 @@ const users = {
}
},
async getCaptcha (store) {
- return await store.rootState.api.backendInteractor.getCaptcha()
+ return store.rootState.api.backendInteractor.getCaptcha()
},
logout (store) {
@@ -376,19 +376,19 @@ const users = {
// Authentication failed
commit('endLogin')
if (response.status === 401) {
- reject('Wrong username or password')
+ reject(new Error('Wrong username or password'))
} else {
- reject('An error occurred, please try again')
+ reject(new Error('An error occurred, please try again'))
}
}
commit('endLogin')
resolve()
})
- .catch((error) => {
- console.log(error)
- commit('endLogin')
- reject('Failed to connect to server, try again')
- })
+ .catch((error) => {
+ console.log(error)
+ commit('endLogin')
+ reject(new Error('Failed to connect to server, try again'))
+ })
})
}
}