浏览代码

remove modelValue from altcha component

olinox14 1 年之前
父节点
当前提交
aa5c42ef6d
共有 1 个文件被更改,包括 3 次插入11 次删除
  1. 3 11
      components/AltchaValidation.client.vue

+ 3 - 11
components/AltchaValidation.client.vue

@@ -12,7 +12,6 @@
 import { ref, onMounted, onUnmounted, type Ref } from 'vue'
 import 'altcha'
 import { useRuntimeConfig } from 'nuxt/app'
-import type { PropType } from '@vue/runtime-core'
 
 const runtimeConfig = useRuntimeConfig()
 const appStore = useAppStore()
@@ -20,23 +19,16 @@ const appStore = useAppStore()
 // Setup a 15min expiration date for the payload
 const expire: number = 15 * 60 * 1000
 
-const widget: Ref<HTMLElement | null> = ref(null)
+const emit = defineEmits(['verified'])
 
-defineProps({
-  modelValue: {
-    type: String as PropType<string | null>,
-    required: true
-  }
-})
-
-const emit = defineEmits(['update:payload'])
+const widget: Ref<HTMLElement | null> = ref(null)
 
 const onStateChange = (e: CustomEvent | Event) => {
   if ('detail' in e) {
     const { payload, state } = e.detail
     if (state === 'verified' && payload) {
+      emit('verified')
       appStore.setAltchaPayload(payload)
-      emit('update:modelValue', payload)
     }
   }
 }