Is there anyway to retrieve all params from a built WPRequest?
What I'm looking for is an object like:
{
"id": 2,
"parent" : 1
}
Resulting from api.posts().id(1).revisions(2). And an object like:
Resulting from api.posts().id(2). But the closer I've got was
function getIndexes(request) {
/* eslint-disable no-param-reassign */
// Internal mutations inside reduce function
const foundIndexers = _reduce(request._path, (indexers, fragment, piece) => {
const id = _find(request._levels[piece], cmp => cmp.validate(fragment));
if (!id) return indexers;
const name = id.component.match(namedGroupRegex);
if (name) {
indexers[name[1]] = fragment;
}
return indexers;
}, { ...request._params });
return foundIndexers;
}
Since I've no access to routesTree, I can't walk and assign the right name to each given _path component.
Thank you
Is there anyway to retrieve all params from a built
WPRequest?What I'm looking for is an object like:
{ "id": 2, "parent" : 1 }Resulting from
api.posts().id(1).revisions(2). And an object like:{ "id": 2 }Resulting from
api.posts().id(2). But the closer I've got wasSince I've no access to routesTree, I can't walk and assign the right name to each given
_pathcomponent.Thank you