Browse Source

simplify mutation

pull/342/head
Guillaume Vincent 7 years ago
parent
commit
133c84f0f8
1 changed files with 1 additions and 6 deletions
  1. +1
    -6
      src/store/mutations.js

+ 1
- 6
src/store/mutations.js View File

@@ -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;


Loading…
Cancel
Save