Skip to content

Commit dc7f59c

Browse files
committed
Fix eslint, remove old-style test case
1 parent 7755bb4 commit dc7f59c

File tree

8 files changed

+36
-113
lines changed

8 files changed

+36
-113
lines changed

components/mixins/blacklistable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ export default {
55
currentUserSettings: 'feathers-vuex-usersettings/current',
66
blacklistPending: 'feathers-vuex-usersettings/isPending'
77
}),
8-
isBlacklisted(){
8+
isBlacklisted () {
99
return this.currentUserSettings.blacklist.includes(this.author()._id)
10-
},
10+
}
1111
},
1212
methods: {
13-
async toggleBlacklist(){
14-
let message;
13+
async toggleBlacklist () {
14+
let message
1515
try {
1616
await this.$store.dispatch('feathers-vuex-usersettings/toggleBlacklist', this.author())
1717
const translationKey = `component.blacklist.${this.isBlacklisted ? 'blockSuccess' : 'unblockSuccess'}`
1818
message = this.$t(translationKey, {
1919
name: this.author().name || this.$t('component.contribution.creatorUnknown')
2020
})
21-
} catch(error) {
21+
} catch (error) {
2222
console.log(error)
2323
message = String(error)
2424
}

helpers/createApiClient.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import socketio from '@feathersjs/socketio-client'
33
import io from 'socket.io-client'
44
import authentication from '@feathersjs/authentication-client'
55
import urlHelper from '~/helpers/urls'
6-
import Cookie from 'cookie-universal';
7-
6+
import Cookie from 'cookie-universal'
87

98
const authKey = 'feathers-jwt'
109
const endpoint = urlHelper.buildEndpointURL(process.env.API_HOST, { port: process.env.API_PORT })
@@ -25,10 +24,8 @@ if (process.env.ENV === 'production') {
2524
socket = socketio(io(endpoint))
2625
}
2726

28-
29-
3027
let createApiClient = ({req, res}) => {
31-
const cookies = Cookie(req, res);
28+
const cookies = Cookie(req, res)
3229
const storageMapping = {
3330
getItem: (key) => {
3431
const res = cookies.get(key)
@@ -62,7 +59,7 @@ let createApiClient = ({req, res}) => {
6259
cookie: authKey
6360
}))
6461

65-
return api;
62+
return api
6663
}
6764

6865
export default createApiClient

plugins/api.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import feathers from '@feathersjs/feathers'
21
import feathersVuex from 'feathers-vuex'
3-
import authentication from '@feathersjs/authentication-client'
42
import Vue from 'vue'
53
import Vuex from 'vuex'
64
import createApiClient from '../helpers/createApiClient'
75

86
export default ({app, store, env, redirect, router, req, res}) => {
9-
const api = createApiClient({req, res});
10-
const { service, auth: feathersVuexAuthentication, FeathersVuex } = feathersVuex(api, { idField: '_id' })
7+
const api = createApiClient({req, res})
8+
const { FeathersVuex } = feathersVuex(api, { idField: '_id' })
119

1210
Vue.use(FeathersVuex)
1311
Vue.use(Vuex)
@@ -76,7 +74,6 @@ export default ({app, store, env, redirect, router, req, res}) => {
7674
api.channel('authenticated').join(connection)
7775
})
7876

79-
8077
// make the api accessible inside vue components
8178
Vue.use({
8279
install (Vue) {

store/auth.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { isEmpty } from 'lodash'
22

3-
export default {
3+
export default {
44
namespaced: true,
55
state: {
66
user: null,
@@ -89,7 +89,7 @@ export default {
8989
}
9090
commit('SET_USER', user)
9191
}
92-
dispatch('feathers-vuex-usersettings/loadCurrent', user, { root: true});
92+
dispatch('feathers-vuex-usersettings/loadCurrent', user, { root: true })
9393
return user
9494
},
9595
async checkAuth ({state, getters, commit, dispatch}) {
@@ -127,7 +127,7 @@ export default {
127127
commit('SET_TOKEN', null)
128128
const user = await this.app.$api.auth({strategy: 'local', email, password})
129129

130-
dispatch('feathers-vuex-usersettings/loadCurrent', user, { root: true});
130+
dispatch('feathers-vuex-usersettings/loadCurrent', user, { root: true })
131131

132132
commit('SET_USER', user)
133133

store/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ const requireModule = require.context(
2323
/.js$/
2424
)
2525

26-
2726
const createStore = (ssrContext) => {
28-
const feathersClient = createApiClient(ssrContext || {});
29-
const { service, auth: feathersVuexAuthentication } = feathersVuex(feathersClient, { idField: '_id' })
27+
const feathersClient = createApiClient(ssrContext || {})
28+
const { auth: feathersVuexAuthentication } = feathersVuex(feathersClient, { idField: '_id' })
3029
const servicePlugins = requireModule.keys().map(modulePath => requireModule(modulePath).default(feathersClient))
3130

3231
return new Vuex.Store({
@@ -58,7 +57,7 @@ const createStore = (ssrContext) => {
5857
'auth-reset-token',
5958
'pages-slug',
6059
'test'
61-
],
60+
]
6261
}
6362
})
6463
]

store/services/usersettings.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ let servicePlugin = (feathersClient) => {
88
getters: {
99
isPending: (state) => {
1010
return (
11-
state.current
12-
|| state.isFindPending
13-
|| state.isGetPending
14-
|| state.isCreatePending
15-
|| state.isUpdatePending
16-
|| state.isPatchPending
17-
|| state.isRemovePending
11+
state.current ||
12+
state.isFindPending ||
13+
state.isGetPending ||
14+
state.isCreatePending ||
15+
state.isUpdatePending ||
16+
state.isPatchPending ||
17+
state.isRemovePending
1818
)
1919
}
2020
},
2121
actions: {
22-
async loadCurrent({commit, dispatch}, user){
23-
let userId = user._id;
22+
async loadCurrent ({commit, dispatch}, user) {
23+
let userId = user._id
2424
let res = await dispatch('find', {
2525
query: { userId }
2626
})
27-
if (res.data.length > 0){
27+
if (res.data.length > 0) {
2828
commit('setCurrent', res.data[0])
2929
}
3030
},
31-
async toggleBlacklist({commit, dispatch, state}, author){
32-
let current = state.copy;
33-
let userId = author._id;
34-
if (current.blacklist.includes(userId)){
35-
current.blacklist = current.blacklist.filter(id => id !== userId);
31+
async toggleBlacklist ({commit, dispatch, state}, author) {
32+
let current = state.copy
33+
let userId = author._id
34+
if (current.blacklist.includes(userId)) {
35+
current.blacklist = current.blacklist.filter(id => id !== userId)
3636
} else {
37-
current.blacklist.push(userId);
37+
current.blacklist.push(userId)
3838
}
39-
await commit('commitCopy');
40-
return dispatch('patch', [current._id, current, {}]);
41-
},
39+
await commit('commitCopy')
40+
return dispatch('patch', [current._id, current, {}])
41+
}
4242
}
4343
})
4444
return servicePlugin

test/helpers/testAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ const testAction = async (action, payload, state, expectedMutations, testrunner)
2626
testrunner.deepEqual(count, 0)
2727
}
2828
}
29-
module.exports = { testAction };
29+
module.exports = { testAction }

test/store/blacklist.test.js

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)