|
5 | 5 | */
|
6 | 6 | import fastCopy from 'fast-copy'
|
7 | 7 | import { getId } from '../utils'
|
| 8 | +import { Service } from '@feathersjs/feathers' |
8 | 9 |
|
9 |
| -export default function makeServiceActions(service) { |
| 10 | +export default function makeServiceActions(service: Service<any>) { |
10 | 11 | const serviceActions = {
|
11 | 12 | find({ commit, dispatch }, params) {
|
12 | 13 | params = params || {}
|
@@ -261,8 +262,8 @@ export default function makeServiceActions(service) {
|
261 | 262 | const { idField, autoRemove } = state
|
262 | 263 |
|
263 | 264 | list.forEach(item => {
|
264 |
| - let id = getId(item, idField) |
265 |
| - let existingItem = state.keyedById[id] |
| 265 | + const id = getId(item, idField) |
| 266 | + const existingItem = state.keyedById[id] |
266 | 267 |
|
267 | 268 | if (id !== null && id !== undefined) {
|
268 | 269 | existingItem ? toUpdate.push(item) : toAdd.push(item)
|
@@ -305,8 +306,8 @@ export default function makeServiceActions(service) {
|
305 | 306 | */
|
306 | 307 | async addOrUpdate({ state, commit }, item) {
|
307 | 308 | const { idField } = state
|
308 |
| - let id = getId(item, idField) |
309 |
| - let existingItem = state.keyedById[id] |
| 309 | + const id = getId(item, idField) |
| 310 | + const existingItem = state.keyedById[id] |
310 | 311 |
|
311 | 312 | const isIdOk = id !== null && id !== undefined
|
312 | 313 |
|
|
0 commit comments