-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathapp.vue
105 lines (91 loc) · 2.62 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
<NuxtLayout>
<NuxtLoadingIndicator />
<LazyClientOnly>
<Confetti v-if="showConfetti" />
<Loading />
</LazyClientOnly>
<NuxtPage />
<CookiePolicy />
<Modal v-if="dialog && dialog.show" @backdrop="handleDialogOnBackdrop()">
<Dialog :dialog="dialog" />
</Modal>
<Snackbar class="z-[999]" />
<div>
<FormWebinarRating
v-for="unratedWebinar of unratedWebinars"
:key="unratedWebinar.id"
:data="unratedWebinar"
@done="ondoneRmWebinar($event)"
/>
</div>
</NuxtLayout>
</template>
<script lang="ts">
import type { Ref } from "vue";
import "highlight.js/styles/github-dark.css";
// <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
export default {
setup() {
const dialog = useDialog();
const showConfetti = useShowConfetti();
function handleDialogOnBackdrop() {
dialog.value &&
dialog.value.triggerPrimaryActionOnBackdropClick &&
dialog.value.primaryBtn.onclick &&
dialog.value.primaryBtn.onclick();
}
const user: Ref<any> = useUser();
const cookie_user = useCookie("user");
user.value = cookie_user.value ?? null;
const session: Ref<any> = useSession();
const cookie_session = useCookie("session");
session.value = cookie_session.value ?? null;
const accessToken = useAccessToken();
const cookie_accessToken = useCookie("accessToken");
accessToken.value = cookie_accessToken.value ?? "";
const refreshToken = useRefreshToken();
const cookie_refreshToken = useCookie("refreshToken");
refreshToken.value = cookie_refreshToken.value ?? "";
const nuxtApp = useNuxtApp();
nuxtApp.hook("page:finish", async () => {
if (!!accessToken.value) {
await getUnratedWebinars();
}
});
const unratedWebinars: Ref<any[]> = useUnratedWebinars();
function ondoneRmWebinar(id: string) {
let index = unratedWebinars.value.findIndex((web) => web.id == id);
if (index < 0) return;
unratedWebinars.value.splice(index, 1);
}
return {
dialog,
handleDialogOnBackdrop,
unratedWebinars,
ondoneRmWebinar,
showConfetti,
};
},
};
</script>
<style>
/* .page-enter-active,
.page-leave-active {
transition: all 0.4s;
}
.page-enter-from,
.page-leave-to {
opacity: 0;
filter: blur(1rem);
}
.layout-enter-active,
.layout-leave-active {
transition: all 0.4s;
}
.layout-enter-from,
.layout-leave-to {
opacity: 0;
filter: blur(1rem);
} */
</style>