-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathapp.vue
33 lines (27 loc) · 897 Bytes
/
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
<template>
<NuxtPage />
<AuthOverlay v-if="isLoginOpen" />
<EditProfileOverlay v-if="isEditProfileOpen" />
</template>
<script setup>
import { storeToRefs } from 'pinia';
const { $userStore, $generalStore } = useNuxtApp()
const { isLoginOpen, isEditProfileOpen } = storeToRefs($generalStore)
onMounted(async () => {
$generalStore.bodySwitch(false)
isLoginOpen.value = false
isEditProfileOpen.value = false
try {
await $generalStore.hasSessionExpired()
await $generalStore.getRandomUsers('suggested')
await $generalStore.getRandomUsers('following')
if ($userStore.id) {
$userStore.getUser()
}
} catch (error) {
console.log(error)
}
})
watch(() => isLoginOpen.value, (val) => $generalStore.bodySwitch(val) )
watch(() => isEditProfileOpen.value, (val) => $generalStore.bodySwitch(val) )
</script>