news-analyze/components/blurPageBeforeLogin.vue
吳元皓 81012f5061 Made the line_today.py kinda work ig. But I have no idea how can I run
this without issues in prod tho. and the "BlurPageBeforeLogin" thing
works just file, oh and checkCookie is now working (but without the
database part just yet)
2025-05-17 23:31:55 +08:00

39 lines
998 B
Vue

<script setup lang="ts">
// Imports
const { t } = useI18n();
// Values
const allowed = ref(false);
const error = ref(false);
const errorMsg = ref("");
const emit = defineEmits(["windowopener", "error", "loadValue"]);
try {
// 喔 我沒有加 await :( 難怪有問題
const { data, error: sendError } = await useFetch("/api/user/checkcookie");
if (sendError.value) {
error.value = true;
}
if (true) {
allowed.value = true;
} else {
allowed.value = false;
}
} catch (e) {
error.value = true;
errorMsg.value = e.message;
}
</script>
<template>
<div
class="flex flex-col bg-gray-200/50 text-black w-full h-full absolute inset-0 justify-center align-middle text-center z-[20] backdrop-blur-sm"
v-if="!allowed || error"
>
<div v-if="!allowed && !error" class="m-2">
{{ t("error") }}
</div>
<div v-if="error" class="m-2">
<span>{{ errorMsg ? errorMsg : "" }} {{ t("systemerror") }}</span>
</div>
</div>
<slot></slot>
</template>