From 6fe565c30f2e37368ec7d9eff26ed766ca3f404a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 3 Jul 2023 23:13:36 +0530 Subject: [PATCH] feat: add action handler to login and logout components --- .../hoppscotch-common/src/components/app/Header.vue | 10 +++++++++- .../src/components/firebase/Logout.vue | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/hoppscotch-common/src/components/app/Header.vue b/packages/hoppscotch-common/src/components/app/Header.vue index ceb683d3f..194e4b1da 100644 --- a/packages/hoppscotch-common/src/components/app/Header.vue +++ b/packages/hoppscotch-common/src/components/app/Header.vue @@ -242,7 +242,7 @@ import { pwaDefferedPrompt, installPWA } from "@modules/pwa" import { platform } from "~/platform" import { useI18n } from "@composables/i18n" import { useReadonlyStream } from "@composables/stream" -import { invokeAction } from "@helpers/actions" +import { defineActionHandler, invokeAction } from "@helpers/actions" import { workspaceStatus$, updateWorkspaceTeamName } from "~/newstore/workspace" import TeamListAdapter from "~/helpers/teams/TeamListAdapter" import { onLoggedIn } from "~/composables/auth" @@ -374,4 +374,12 @@ const profile = ref(null) const settings = ref(null) const logout = ref(null) const accountActions = ref(null) + +defineActionHandler( + "user.login", + () => { + invokeAction("modals.login.toggle") + }, + computed(() => !currentUser.value) +) diff --git a/packages/hoppscotch-common/src/components/firebase/Logout.vue b/packages/hoppscotch-common/src/components/firebase/Logout.vue index 8da86d6ad..58c5e2779 100644 --- a/packages/hoppscotch-common/src/components/firebase/Logout.vue +++ b/packages/hoppscotch-common/src/components/firebase/Logout.vue @@ -1,12 +1,12 @@