Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 2x 2x 2x 2x 2x 2x | import { setResourceObjectsForModule } from './setResourceObjectsForModule' import { isMissingModule, registerMissingModule } from './missingModule' import { hasOwn } from '../../shared/utils' /** * Process the (normalized) data part of a response * * @param {Object} vuexFns * @param {ResourcefulApi} api * @param {String} currentModule name of the current storeModule * @param {Object} data payload from request * @param {String} currentMethod default = '' * @param {Object} module storeModule */ export function processResponseData (vuexFns, api, currentModule, data, currentMethod = '', module = null) { for (const itemType in data) { let registeredModule = itemType Iif (module !== null && module.state.options.absoluteMethods.includes(currentMethod)) { registeredModule = currentModule } else Iif (!hasOwn(data, itemType)) { // TODO: add error here, invalid resource format continue } Iif (isMissingModule(api.store, registeredModule)) { registerMissingModule(api.store, api, registeredModule) } setResourceObjectsForModule( vuexFns, currentModule, registeredModule, data[itemType] ) } } |