attached login and disconnect to Header.vue
This commit is contained in:
@@ -125,6 +125,7 @@ async function login() {
|
||||
} catch (error) {
|
||||
errorSnackBar.value = true;
|
||||
}
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const googleCallback = async (response) => {
|
||||
|
||||
@@ -1,63 +1,9 @@
|
||||
<template>
|
||||
<!-- <footer class="text-center text-surface/75 dark:bg-gray-950 dark:text-white/75 lg:text-left">-->
|
||||
<!-- <div class="mx-6 py-10 text-center md:text-left">-->
|
||||
<!-- <div class="grid-1 grid gap-4 grid-cols-2">-->
|
||||
<!-- <!– Useful links section –>-->
|
||||
<!-- <div>-->
|
||||
<!-- <h6 class="mb-4 flex justify-center font-semibold uppercase md:justify-start">-->
|
||||
<!-- Liens utils-->
|
||||
<!-- </h6>-->
|
||||
<!-- <p class="mb-4">-->
|
||||
<!-- <a href="#">Pricing</a>-->
|
||||
<!-- </p>-->
|
||||
<!-- <p class="mb-4">-->
|
||||
<!-- <a href="#">Aide & Contact</a>-->
|
||||
<!-- </p>-->
|
||||
<!-- <p class="mb-4">-->
|
||||
<!-- <a href="#">Conditions générales d'utilisation</a>-->
|
||||
<!-- </p>-->
|
||||
<!-- <p class="mb-4">-->
|
||||
<!-- <a href="#">Conditions générales de vente</a>-->
|
||||
<!-- </p>-->
|
||||
<!-- <p class="mb-4">-->
|
||||
<!-- <a href="#">Cookies</a>-->
|
||||
<!-- </p>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <!– Contacts–>-->
|
||||
<!-- <div>-->
|
||||
<!-- <h6 class="mb-4 flex justify-center font-semibold uppercase md:justify-start">Contact</h6>-->
|
||||
<!-- <p class="mb-4 flex items-center justify-center md:justify-start">-->
|
||||
<!-- <div class="flex justify-center">-->
|
||||
<!-- <a href="#" class="me-6 [&>svg]:h-4 [&>svg]:w-4">-->
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 320 512">-->
|
||||
<!-- <!–!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. –>-->
|
||||
<!-- <path d="M80 299.3V512H196V299.3h86.5l18-97.8H196V166.9c0-51.7 20.3-71.5 72.7-71.5c16.3 0 29.4 .4 37 1.2V7.9C291.4 4 256.4 0 236.2 0C129.3 0 80 50.5 80 159.4v42.1H14v97.8H80z"/>-->
|
||||
<!-- </svg>-->
|
||||
<!-- </a>-->
|
||||
<!-- <a href="#" class="me-6 [&>svg]:h-4 [&>svg]:w-4">-->
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 448 512">-->
|
||||
<!-- <!–!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. –>-->
|
||||
<!-- <path d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z" />-->
|
||||
<!-- </svg>-->
|
||||
<!-- </a>-->
|
||||
<!-- <a href="mailto:a@hutopy.com" class="me-6 [&>svg]:h-4 [&>svg]:w-4">-->
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">-->
|
||||
<!-- <!–!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. –>-->
|
||||
<!-- <path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" />-->
|
||||
<!-- <path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" />-->
|
||||
<!-- </svg>-->
|
||||
<!-- </a>-->
|
||||
<!-- </div>-->
|
||||
<!-- </p>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <div class="bg-black/5 p-6 text-center">-->
|
||||
<!-- {{ new Date().getFullYear() }} — <strong>Hutopy v.01</strong>-->
|
||||
<!-- </div>-->
|
||||
<!-- </footer>-->
|
||||
<footer>
|
||||
<div class="bg-black/5 p-6 text-center">
|
||||
{{ new Date().getFullYear() }} — <strong>Hutopy v.01</strong>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -62,18 +62,17 @@
|
||||
</template>
|
||||
|
||||
<v-list class="mt-2">
|
||||
<v-list-item @click="navigateToProfile">
|
||||
|
||||
<v-list-item>
|
||||
<v-list-item-title>
|
||||
<router-link to="/profile">
|
||||
Mon profil
|
||||
Mon profil
|
||||
</router-link>
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>
|
||||
<router-link to="/wallet">
|
||||
Mon wallet
|
||||
Mon wallet
|
||||
</router-link>
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
@@ -93,16 +92,18 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted, onBeforeUnmount} from "vue";
|
||||
import {eventBus} from '@/eventBus.js';
|
||||
import {useRouter} from 'vue-router';
|
||||
|
||||
import MyUserModel from "@/models/myUserModel.js";
|
||||
import { useClient } from "@/plugins/api.js";
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import { eventBus } from '@/eventBus.js';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const router = useRouter();
|
||||
const currentUserName = "Pascal Marchesseault";
|
||||
const currentUserName = ref("INVITÉ");
|
||||
const searchQuery = ref("");
|
||||
const showSearch = ref(false);
|
||||
|
||||
let currentUser = null;
|
||||
const client = useClient();
|
||||
|
||||
const toggleSidebar = () => {
|
||||
eventBus.value.toggleSidebar();
|
||||
@@ -117,7 +118,7 @@ const onSearch = () => {
|
||||
if (words.length === 1) {
|
||||
router.push(`/@${words[0]}`);
|
||||
} else {
|
||||
router.push({name: "browse", query: {q: query}});
|
||||
router.push({ name: "browse", query: { q: query } });
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -132,13 +133,6 @@ const handleClickOutside = (event) => {
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('click', handleClickOutside);
|
||||
});
|
||||
const navigateToWallet = () => {
|
||||
router.push('/wallet');
|
||||
};
|
||||
@@ -147,13 +141,29 @@ const navigateToMessages = () => {
|
||||
router.push('/messages');
|
||||
};
|
||||
|
||||
function logout() {
|
||||
const logout = () => {
|
||||
localStorage.removeItem('jwt');
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const myUser = await client.get("/api/GetMyUser");
|
||||
const currentUserModel = MyUserModel.createFromApiResult(myUser.data);
|
||||
currentUser = currentUserModel;
|
||||
currentUserName.value = currentUserModel.firstName + " " + currentUserModel.lastName;
|
||||
} catch (error) {
|
||||
console.log("User not logged");
|
||||
}
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('click', handleClickOutside);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.search-container {
|
||||
position: relative;
|
||||
|
||||
Reference in New Issue
Block a user