Adding apisSorter options, taking a string or a function as a configuration value
This commit is contained in:
@@ -197,16 +197,21 @@ export const operationsWithTags = createSelector(
|
||||
}
|
||||
)
|
||||
|
||||
export const taggedOperations = ( state ) =>( { getConfigs } ) => {
|
||||
let { operationsSorter }= getConfigs()
|
||||
export const taggedOperations = (state) => ({ getConfigs }) => {
|
||||
let { apisSorter, operationsSorter } = getConfigs();
|
||||
|
||||
return operationsWithTags(state).map((ops, tag) => {
|
||||
let sortFn = typeof operationsSorter === "function" ? operationsSorter
|
||||
: sorters.operationsSorter[operationsSorter]
|
||||
let operations = !sortFn ? ops : ops.sort(sortFn)
|
||||
return operationsWithTags(state)
|
||||
.sort((operationA, operationB) => {
|
||||
let sortFn = (typeof apisSorter === "function" ? apisSorter : sorters.apisSorter[ apisSorter ]);
|
||||
return (!sortFn ? null : sortFn(operationA, operationB));
|
||||
})
|
||||
.map((ops, tag) => {
|
||||
let sortFn = (typeof operationsSorter === "function" ? operationsSorter : sorters.operationsSorter[ operationsSorter ]);
|
||||
let operations = (!sortFn ? ops : ops.sort(sortFn));
|
||||
|
||||
return Map({tagDetails: tagDetails(state, tag), operations: operations})})
|
||||
}
|
||||
return Map({ tagDetails: tagDetails(state, tag), operations: operations });
|
||||
});
|
||||
};
|
||||
|
||||
export const responses = createSelector(
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user