From 133c84f0f80c8237d80dc0c1304aa836cae60618 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Thu, 19 Oct 2017 19:32:33 +0200 Subject: [PATCH] simplify mutation --- src/store/mutations.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/store/mutations.js b/src/store/mutations.js index 6f52025..4ffd7e2 100644 --- a/src/store/mutations.js +++ b/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;