16 lines
351 B
TypeScript
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 }
|
|
}
|