Skip to content

Commit

Permalink
refactor: update button click event handling in index.vue and vote.vue (
Browse files Browse the repository at this point in the history
  • Loading branch information
garyellow authored Jun 1, 2024
1 parent deebc9d commit cb3202b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
v-if="status === 'authenticated'"
type="success"
class="z-10 mt-2 mb-8"
@click="useRouter().push('/vote')"
@click="router.push('/vote')"
>
<span class="font-bold">前 往 投 票 頁 面</span>
</ElButton>
<ElButton
v-else
type="primary"
class="z-10 mt-2 mb-8"
@click="useRouter().push('/login')"
@click="router.push('/login')"
>
<span class="font-bold">前 往 登 入 頁 面</span>
</ElButton>
Expand All @@ -72,6 +72,7 @@ definePageMeta({
title: "首頁",
});
const router = useRouter();
const { status } = useAuthState();
const style = (start: Date, end: Date) => {
Expand Down
15 changes: 10 additions & 5 deletions pages/vote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,15 @@ 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({
type: "success",
message: "已複製",
});
resultLoading.value[index] = false;
await useRouter().push("/result/" + index);
}
});
Expand All @@ -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;
});
}
};
Expand Down

1 comment on commit cb3202b

@vercel
Copy link

@vercel vercel bot commented on cb3202b Jun 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ntpusu-vote – ./

ntpusu-vote.vercel.app
ntpusu-vote-git-main-ntpusu.vercel.app
ntpusu-vote-ntpusu.vercel.app

Please sign in to comment.