Skip to content

Commit 9e45044

Browse files
committed
add getters to access isPendingId state
1 parent 9d97f2b commit 9e45044

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/service-module/service-module.getters.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { globalModels as models } from './global-models'
1010
import _get from 'lodash/get'
1111
import _omit from 'lodash/omit'
1212
import { isRef } from '@vue/composition-api'
13+
import { ServiceState } from '..'
14+
import { Id } from '@feathersjs/feathers'
1315

1416
const FILTERS = ['$sort', '$limit', '$skip', '$select']
1517
const OPERATORS = ['$in', '$nin', '$lt', '$lte', '$gt', '$gte', '$ne', '$or']
@@ -114,6 +116,20 @@ export default function makeServiceGetters() {
114116

115117
return Model.copiesById[id]
116118
}
117-
}
119+
},
120+
121+
isCreatePendingById: ({ isIdCreatePending }: ServiceState) => (id: Id) =>
122+
isIdCreatePending.includes(id),
123+
isUpdatePendingById: ({ isIdUpdatePending }: ServiceState) => (id: Id) =>
124+
isIdUpdatePending.includes(id),
125+
isPatchPendingById: ({ isIdPatchPending }: ServiceState) => (id: Id) =>
126+
isIdPatchPending.includes(id),
127+
isRemovePendingById: ({ isIdRemovePending }: ServiceState) => (id: Id) =>
128+
isIdRemovePending.includes(id),
129+
isPendingById: (state: ServiceState, getters) => (id: Id) =>
130+
getters.isCreatePendingById(id) ||
131+
getters.isUpdatePendingById(id) ||
132+
getters.isPatchPendingById(id) ||
133+
getters.isRemovePendingById(id)
118134
}
119135
}

0 commit comments

Comments
 (0)