You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`Values in the 'watch' array must be strings.`)
249
-
}
250
-
prop=prop.replace('params',PARAMS)
247
+
if(
248
+
pType.hasOwnProperty(PARAMS)||
249
+
pType.hasOwnProperty(FETCH_PARAMS)
250
+
){
251
+
watch.forEach(prop=>{
252
+
if(typeofprop!=='string'){
253
+
thrownewError(`Values in the 'watch' array must be strings.`)
254
+
}
255
+
prop=prop.replace('params',PARAMS)
251
256
252
-
if(pType.hasOwnProperty(FETCH_PARAMS)){
253
-
if(prop.startsWith(PARAMS)){
254
-
prop=prop.replace(PARAMS,FETCH_PARAMS)
257
+
if(pType.hasOwnProperty(FETCH_PARAMS)){
258
+
if(prop.startsWith(PARAMS)){
259
+
prop=prop.replace(PARAMS,FETCH_PARAMS)
260
+
}
255
261
}
256
-
}
257
-
this.$watch(prop,function(){
258
-
// If the request is going to be debounced, set IS_FIND_PENDING to true.
259
-
// Without this, there's not a way to show a loading indicator during the debounce timeout.
260
-
constparamsToUse=getParams({
261
-
providedParams: null,
262
-
params: this[PARAMS],
263
-
fetchParams: this[FETCH_PARAMS]
262
+
this.$watch(prop,function(){
263
+
// If the request is going to be debounced, set IS_FIND_PENDING to true.
264
+
// Without this, there's not a way to show a loading indicator during the debounce timeout.
265
+
constparamsToUse=getParams({
266
+
providedParams: null,
267
+
params: this[PARAMS],
268
+
fetchParams: this[FETCH_PARAMS]
269
+
})
270
+
if(paramsToUse&¶msToUse.debounce){
271
+
this[IS_FIND_PENDING]=true
272
+
}
273
+
returnthis[`${FIND_ACTION}DebouncedProxy`]()
264
274
})
265
-
if(paramsToUse&¶msToUse.debounce){
266
-
this[IS_FIND_PENDING]=true
267
-
}
268
-
returnthis[`${FIND_ACTION}DebouncedProxy`]()
269
275
})
270
-
})
271
276
272
-
returnthis[FIND_ACTION]()
273
-
}else{
274
-
if(!local){
277
+
returnthis[FIND_ACTION]()
278
+
}else{
275
279
// TODO: Add this message to the logging:
276
280
// "Pass { local: true } to disable this warning and only do local queries."
277
281
console.log(
278
282
`No "${PARAMS}" or "${FETCH_PARAMS}" attribute was found in the makeFindMixin for the "${service}" service (using name "${nameToUse}"). No queries will be made.`
// add the created lifecycle hook only if local option is falsy
122
+
...(!local&&{
123
+
created(){
124
+
if(debug){
125
+
console.log(
126
+
`running 'created' hook in makeGetMixin for service "${service}" (using name ${nameToUse}")`
127
+
)
128
+
console.log(ID,this[ID])
129
+
console.log(PARAMS,this[PARAMS])
130
+
console.log(FETCH_PARAMS,this[FETCH_PARAMS])
142
131
}
143
132
144
-
watch.forEach(prop=>{
145
-
if(typeofprop!=='string'){
146
-
thrownewError(`Values in the 'watch' array must be strings.`)
133
+
constpType=Object.getPrototypeOf(this)
134
+
135
+
if(
136
+
this.hasOwnProperty(ID)||
137
+
pType.hasOwnProperty(ID)||
138
+
pType.hasOwnProperty(PARAMS)||
139
+
pType.hasOwnProperty(FETCH_PARAMS)
140
+
){
141
+
if(!watch.includes(ID)){
142
+
watch.push(ID)
147
143
}
148
-
prop=prop.replace('query',PARAMS)
149
144
150
-
if(pType.hasOwnProperty(FETCH_PARAMS)){
151
-
if(prop.startsWith(PARAMS)){
152
-
prop.replace(PARAMS,FETCH_PARAMS)
145
+
watch.forEach(prop=>{
146
+
if(typeofprop!=='string'){
147
+
thrownewError(`Values in the 'watch' array must be strings.`)
153
148
}
154
-
}
155
-
this.$watch(prop,function(){
156
-
returnthis[GET_ACTION]()
149
+
prop=prop.replace('query',PARAMS)
150
+
151
+
if(pType.hasOwnProperty(FETCH_PARAMS)){
152
+
if(prop.startsWith(PARAMS)){
153
+
prop.replace(PARAMS,FETCH_PARAMS)
154
+
}
155
+
}
156
+
this.$watch(prop,function(){
157
+
returnthis[GET_ACTION]()
158
+
})
157
159
})
158
-
})
159
160
160
-
returnthis[GET_ACTION]()
161
-
}else{
162
-
console.log(
163
-
`No "${ID}", "${PARAMS}" or "${FETCH_PARAMS}" attribute was found in the makeGetMixin for the "${service}" service (using name "${nameToUse}"). No queries will be made.`
164
-
)
161
+
returnthis[GET_ACTION]()
162
+
}else{
163
+
console.log(
164
+
`No "${ID}", "${PARAMS}" or "${FETCH_PARAMS}" attribute was found in the makeGetMixin for the "${service}" service (using name "${nameToUse}"). No queries will be made.`
0 commit comments