- client: Submit setFiltersConfig action on if the values are changed: Merge pull request in DNS/adguard-home from fix/1749 to master

Close 

Squashed commit of the following:

commit aaf4ba86429670ea8b0001325562c4a173be5b4a
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri May 29 13:29:44 2020 +0300

    - client: Submit setFiltersConfig action on if the values are changed
This commit is contained in:
Artem Baskal 2020-05-29 16:08:01 +03:00
parent 72f253f62b
commit b8032801a2
4 changed files with 38 additions and 22 deletions
client/src/helpers

View file

@ -482,6 +482,19 @@ export const getCurrentFilter = (url, filters) => {
};
};
/**
* @param {object} initialValues
* @param {object} values
* @returns {object} Returns different values of objects
*/
export const getObjDiff = (initialValues, values) => Object.entries(values)
.reduce((acc, [key, value]) => {
if (value !== initialValues[key]) {
acc[key] = value;
}
return acc;
}, {});
/**
* @param number Number to format
* @returns string Returns a string with a language-sensitive representation of this number