浏览代码

simplify mutation

pull/342/head
Guillaume Vincent 7 年前
父节点
当前提交
133c84f0f8
共有 1 个文件被更改,包括 1 次插入6 次删除
  1. +1
    -6
      src/store/mutations.js

+ 1
- 6
src/store/mutations.js 查看文件

@@ -42,23 +42,18 @@ export default {
if (!site || typeof state.password.id !== "undefined") {
return;
}
let siteMatch = false;
state.password = Object.assign({}, state.password, { site });
const passwords = state.passwords || [];
const siteWithoutWWW = site.replace(/^www./g, "");
for (let i = 0; i < passwords.length; i++) {
const password = passwords[i];
if (site.endsWith(password.site)) {
state.password = { ...password };
siteMatch = true;
break;
} else if (password.site.endsWith(siteWithoutWWW)) {
state.password = { ...password };
siteMatch = true;
}
}
if (site && !siteMatch) {
state.password = Object.assign({}, state.password, { site });
}
},
[types.SET_MESSAGE](state, { message }) {
state.message = message;


正在加载...
取消
保存