From dc782eb4802285dc39cc162a741175d6c81c50f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aron=20Sch=C3=BCler?= Date: Sun, 28 Jan 2024 12:55:08 +0100 Subject: [PATCH] feat: convert user.ts into a pinia store and redirect away from creation form --- src/components/TopBar.vue | 10 +++++----- src/components/UserMenu.vue | 8 ++++---- src/components/user.ts | 5 +++-- src/views/AddCommentForm.vue | 12 ++++++------ src/views/NewProject.vue | 30 ++++++++++++++++++++++-------- src/views/UpvoteButton.vue | 12 ++++++------ 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index fa0fa72..e009869 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -6,7 +6,7 @@ import { Bars3Icon, BellIcon, XMarkIcon } from "@heroicons/vue/24/outline"; import { signOut, userNavigation, useUser } from "./user"; import UserMenu from "./UserMenu.vue"; -const { user } = useUser(); +const userStore = useUser(); const appNavigation = [ { @@ -101,9 +101,9 @@ const appNavigation = [
@@ -116,11 +116,11 @@ const appNavigation = [
- {{ user?.displayName }} + {{ userStore.user?.displayName }}
- {{ user?.email }} + {{ userStore.user?.email }}
diff --git a/src/components/UserMenu.vue b/src/components/UserMenu.vue index 9e2c751..673bd8f 100644 --- a/src/components/UserMenu.vue +++ b/src/components/UserMenu.vue @@ -3,11 +3,11 @@ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue"; import { BellIcon, UserCircleIcon } from "@heroicons/vue/20/solid"; import { signOut, userNavigation, useUser } from "./user"; -const { user, isLoggedIn } = useUser(); +const userStore = useUser();