Check defaults against query set to make sure credential_type does not get overwritten

- We want to preserve the existing `credential_type` param that already
exists in `queryset` and not have `defaults
` overwrite it. We first loop through the `defaults` object keys and
check it against the the keys of `queryset` and if the keys match, then
set the value to `queryset[key]`.
This commit is contained in:
kialam 2018-06-01 16:39:04 -04:00
parent 85aeb799dc
commit 99ea28c3fd

View File

@ -235,11 +235,15 @@ function SmartSearchController (
};
$scope.clearAllTerms = () => {
const cleared = _(defaults).omit(_.isNull).value();
const cleared = {};
delete cleared.page;
_.forOwn(defaults, function(value, key) {
if (key !== "page") {
cleared[key] = _.has(queryset, key) ? queryset[key] : value;
}
});
queryset = cleared;
queryset = _(cleared).omit(_.isNull).value();
if (!$scope.querySet) {
$state.go('.', { [searchKey]: queryset });