add save rule button

This commit is contained in:
Gabe Yuan
2023-09-10 13:09:19 +08:00
parent 3a59a127d1
commit e7a5e5dce1

View File

@@ -143,7 +143,7 @@ export const checkRules = (rules) => {
*/
export const saveRule = async (newRule) => {
const rules = await getRulesWithDefault();
const rule = rules.find((item) => isMatch(item.pattern, newRule.pattern));
const rule = rules.find((item) => isMatch(newRule.pattern, item.pattern));
if (rule) {
Object.assign(rule, { ...newRule, pattern: rule.pattern });
} else {