added auth support
This commit is contained in:
parent
869be69d67
commit
f3dbaef776
7 changed files with 112 additions and 3 deletions
|
|
@ -2,11 +2,13 @@
|
|||
const dropdownOpen = ref(false)
|
||||
const profileMenu = ref<HTMLElement | null>(null)
|
||||
|
||||
function toggleDropdown() {
|
||||
const {logout} = useAuth()
|
||||
|
||||
const toggleDropdown = () => {
|
||||
dropdownOpen.value = !dropdownOpen.value
|
||||
}
|
||||
|
||||
function onClickOutside(e: MouseEvent) {
|
||||
const onClickOutside = (e: MouseEvent) => {
|
||||
if (profileMenu.value && !profileMenu.value.contains(e.target as Node)) {
|
||||
dropdownOpen.value = false
|
||||
}
|
||||
|
|
@ -26,7 +28,7 @@ onUnmounted(() => document.removeEventListener('click', onClickOutside))
|
|||
<li>
|
||||
<NuxtLink to="/account" @click="dropdownOpen = false">Account</NuxtLink>
|
||||
</li>
|
||||
<li>Log Out</li>
|
||||
<li @click="logout">Log Out</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue