diff --git a/pages/index.vue b/pages/index.vue
index 6e8431e..68e9ffa 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -51,7 +51,7 @@
v-if="status === 'authenticated'"
type="success"
class="z-10 mt-2 mb-8"
- @click="useRouter().push('/vote')"
+ @click="router.push('/vote')"
>
前 往 投 票 頁 面
@@ -59,7 +59,7 @@
v-else
type="primary"
class="z-10 mt-2 mb-8"
- @click="useRouter().push('/login')"
+ @click="router.push('/login')"
>
前 往 登 入 頁 面
@@ -72,6 +72,7 @@ definePageMeta({
title: "首頁",
});
+const router = useRouter();
const { status } = useAuthState();
const style = (start: Date, end: Date) => {
diff --git a/pages/vote.vue b/pages/vote.vue
index 8007b14..de8f145 100644
--- a/pages/vote.vue
+++ b/pages/vote.vue
@@ -638,6 +638,8 @@ const seeResult = async (index: number) => {
await useRouter().push("/result/" + index);
})
.catch(async (action: Action) => {
+ resultLoading.value[index] = false;
+
if (action === "cancel") {
await navigator.clipboard.writeText(data.value!.tokens[index]);
ElMessage({
@@ -645,7 +647,6 @@ const seeResult = async (index: number) => {
message: "已複製",
});
- resultLoading.value[index] = false;
await useRouter().push("/result/" + index);
}
});
@@ -658,10 +659,14 @@ const seeResult = async (index: number) => {
customStyle: {
fontFamily: '"Noto Sans TC", sans-serif',
},
- }).then(async () => {
- resultLoading.value[index] = false;
- await useRouter().push("/result/" + index);
- });
+ })
+ .then(async () => {
+ resultLoading.value[index] = false;
+ await useRouter().push("/result/" + index);
+ })
+ .catch(() => {
+ resultLoading.value[index] = false;
+ });
}
};