|
|
@@ -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)
|
|
|
}
|
|
|
}
|
|
|
}
|