diff --git a/lib/components/ms-input/MsCodeValidationInput.vue b/lib/components/ms-input/MsCodeValidationInput.vue index 7b75741..e7c3c08 100644 --- a/lib/components/ms-input/MsCodeValidationInput.vue +++ b/lib/components/ms-input/MsCodeValidationInput.vue @@ -55,8 +55,8 @@ const props = defineProps<{ validationFunction: (code: Array) => Promise; }>(); -defineEmits<{ - (e: 'codeComplete', code: Array, valid: boolean): void; +const emits = defineEmits<{ + (e: 'codeComplete'): void; }>(); async function onPaste(event: ClipboardEvent): Promise { @@ -102,6 +102,9 @@ async function onKeyUpBackspace(event: KeyboardEvent): Promise { async function checkCode(): Promise { if (props.codeLength === codes.value.length) { isFinalCodeValid.value = await props.validationFunction(codes.value); + if (isFinalCodeValid.value === true) { + emits('codeComplete'); + } } else { isFinalCodeValid.value = undefined; }