Browse Source

fix Awesomplete not refreshing after passwords update

pull/342/head
Guillaume Vincent 7 years ago
parent
commit
6523044754
1 changed files with 15 additions and 11 deletions
  1. +15
    -11
      src/views/PasswordGenerator.vue

+ 15
- 11
src/views/PasswordGenerator.vue View File

@@ -176,17 +176,6 @@
}); });
}, },
mounted(){ mounted(){
const self = this;
new Awesomplete(this.$refs.site, {
list: this.passwords.map(password => {
return {label: password.site + ' ' + password.login, value: password}
}),
replace: function (password) {
self.$store.dispatch('savePassword', {password: password.value});
this.input.value = password.value.site;
}
});

if (this.password.site) { if (this.password.site) {
this.$refs.login.focus(); this.$refs.login.focus();
} else { } else {
@@ -205,6 +194,21 @@
} }
}, },
watch: { watch: {
'passwords': function (passwords) {
var site = document.getElementById('site');
const self = this;
if (site !== null && passwords.length > 0) {
new Awesomplete(site, {
list: passwords.map(password => {
return {label: password.site + ' ' + password.login, value: password}
}),
replace: function (password) {
self.$store.dispatch('savePassword', {password: password.value});
this.input.value = password.value.site;
}
});
}
},
'password.site': function () { 'password.site': function () {
this.cleanErrors(); this.cleanErrors();
}, },


Loading…
Cancel
Save