diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-01-17 00:52:55 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-01-17 00:52:55 +0300 |
commit | af0787405125095ab34da95f9bc2f019a1439feb (patch) | |
tree | 49f1250c10ed7bb369f783fd3ca5d71819fa6bb8 /src/vue | |
parent | 6de44605c8545f668ca06d2acf992885a54d6b57 (diff) |
[#132] Wait for settings before generating password
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
Diffstat (limited to 'src/vue')
-rw-r--r-- | src/vue/Components/Tools/Generate.vue | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/vue/Components/Tools/Generate.vue b/src/vue/Components/Tools/Generate.vue index 2648204..176691d 100644 --- a/src/vue/Components/Tools/Generate.vue +++ b/src/vue/Components/Tools/Generate.vue @@ -82,28 +82,22 @@ }, mounted() { - Promise.all( - [ - this.loadSetting('strength'), - this.loadSetting('numbers'), - this.loadSetting('special') - ] - ).then(() => { + let promises = [ + this.loadSetting('strength'), + this.loadSetting('numbers'), + this.loadSetting('special') + ]; + + Promise.all(promises).then(() => { this.generating = false; this.generatePassword(); }); }, methods: { - loadSetting(type) { - new Promise((resolve) => { - SettingsService - .getValue(`password.generator.${type}`) - .then((v) => { - this[type] = v; - resolve(); - }); - }); + async loadSetting(type) { + this[type] = await SettingsService.getValue(`password.generator.${type}`); + console.log(this[type]); }, copy() { let data = this.password, @@ -120,6 +114,7 @@ async generatePassword() { if(this.generating) return; this.generating = true; + console.trace({numbers: this.numbers, special: this.special, strength: this.strength}); let response = /** @type {Message} **/ await MessageService .send({type: 'password.generate', payload: {numbers: this.numbers, special: this.special, strength: this.strength}}); let data = response.getPayload(); |