Files
x-forend/src/hooks/useCaptcha.ts
T
2025-01-09 16:06:52 +08:00

16 lines
351 B
TypeScript

const baseUrl = import.meta.env.VITE_SERVER_BASEURL
export const useCaptcha = () => {
const t = ref(Date.now())
const codeUrl = computed(() => {
return baseUrl + '/api/index/captcha?t=' + t.value
})
const refreshCode = () => {
t.value = Date.now()
}
onMounted(() => {
refreshCode()
})
return { codeUrl, t, refreshCode }
}