2024-10-28 11:36:45 +03:00
|
|
|
<template>
|
|
|
|
<v-card class="bg-gradient" style="height: 100%">
|
|
|
|
<v-card-text class="d-flex justify-center align-center">
|
2024-10-28 12:59:00 +03:00
|
|
|
<v-card class="align-center justify-center h-auto card-bg" :class="isWide ? 'w-66' : 'w-100'">
|
2024-10-28 11:36:45 +03:00
|
|
|
<v-card-title class="d-flex justify-space-between">
|
|
|
|
<div>
|
|
|
|
<span>Добро пожаловать в </span>
|
2024-11-22 02:45:27 +03:00
|
|
|
<span><a href="/" class="link-no-decor">Wishlist</a>, </span>
|
|
|
|
<span v-if="userStore.user !== null">{{ userStore.user['name'] }}</span>
|
|
|
|
<span v-else>Гость</span>
|
2024-10-28 11:36:45 +03:00
|
|
|
</div>
|
2024-12-20 11:23:03 +03:00
|
|
|
<span v-if="isAuthenticated" class="link-no-decor align-end" @click="logout">Выйти</span>
|
|
|
|
<div v-else>
|
|
|
|
<a class="link-no-decor align-end" @click="showAuthDialog = true">Вход/Регистрация</a>
|
|
|
|
</div>
|
|
|
|
<v-dialog v-model="showAuthDialog">
|
|
|
|
<v-card class="card-bg">
|
|
|
|
<v-card-title class="d-flex justify-end">
|
|
|
|
<v-icon @click="showAuthDialog = false" class="cursor-pointer" color="white" icon="mdi-close-thick"></v-icon>
|
|
|
|
</v-card-title>
|
|
|
|
</v-card>
|
|
|
|
</v-dialog>
|
2024-10-28 11:36:45 +03:00
|
|
|
</v-card-title>
|
|
|
|
<v-card-text class="d-flex justify-center align-center h-auto">
|
|
|
|
<ShowWhishlist/>
|
|
|
|
</v-card-text>
|
|
|
|
</v-card>
|
|
|
|
</v-card-text>
|
|
|
|
</v-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ShowWhishlist from "./PublicWishlist/ShowWhishlist.vue";
|
2024-11-22 02:45:27 +03:00
|
|
|
import {useUserStore} from "../store/user.js";
|
2024-12-20 11:23:03 +03:00
|
|
|
import { watch } from "vue";
|
2024-10-28 11:36:45 +03:00
|
|
|
export default {
|
|
|
|
name: "Public",
|
2024-10-28 12:59:00 +03:00
|
|
|
components: {ShowWhishlist},
|
|
|
|
data: ()=>({
|
2024-12-20 11:23:03 +03:00
|
|
|
isAuthenticated: false,
|
2024-11-22 02:45:27 +03:00
|
|
|
isWide: window.innerWidth >= 800,
|
2024-12-20 11:23:03 +03:00
|
|
|
userStore: useUserStore(),
|
|
|
|
showAuthDialog: false
|
2024-11-22 02:45:27 +03:00
|
|
|
}),
|
|
|
|
mounted() {
|
2024-12-20 11:23:03 +03:00
|
|
|
watch(this.userStore, (newStore, oldStore)=>{
|
|
|
|
this.isAuthenticated = newStore.user !== null && newStore.user !== undefined;
|
|
|
|
});
|
2024-11-22 02:45:27 +03:00
|
|
|
useUserStore().checkUser();
|
2024-12-20 11:23:03 +03:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async logout() {
|
|
|
|
this.userStore.logout();
|
|
|
|
window.location.reload();
|
|
|
|
}
|
2024-11-22 02:45:27 +03:00
|
|
|
}
|
2024-10-28 11:36:45 +03:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
.bg-gradient {
|
|
|
|
background: linear-gradient(-45deg, #000610, #000f25, #00152f);
|
|
|
|
background-size: 100% 100%;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|