mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 00:06:15 -04:00
refactor(dry): mutualised duplicated code with withDefaultOnError
This commit is contained in:
parent
208a373fd0
commit
f6cd9b76d3
4 changed files with 10 additions and 35 deletions
|
@ -60,6 +60,7 @@
|
|||
<script setup lang="ts">
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import {
|
||||
chineseSimplifiedWordList,
|
||||
chineseTraditionalWordList,
|
||||
|
@ -105,12 +106,7 @@ const passphrase = computed({
|
|||
},
|
||||
set(value: string) {
|
||||
passphraseInput.value = value;
|
||||
|
||||
try {
|
||||
entropy.value = mnemonicToEntropy(value, languages[language.value]);
|
||||
} catch (_) {
|
||||
entropy.value = '';
|
||||
}
|
||||
entropy.value = withDefaultOnError(() => mnemonicToEntropy(value, languages[language.value]), '');
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue