feat: add action handler to login and logout components
This commit is contained in:
@@ -242,7 +242,7 @@ import { pwaDefferedPrompt, installPWA } from "@modules/pwa"
|
|||||||
import { platform } from "~/platform"
|
import { platform } from "~/platform"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { invokeAction } from "@helpers/actions"
|
import { defineActionHandler, invokeAction } from "@helpers/actions"
|
||||||
import { workspaceStatus$, updateWorkspaceTeamName } from "~/newstore/workspace"
|
import { workspaceStatus$, updateWorkspaceTeamName } from "~/newstore/workspace"
|
||||||
import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
|
import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
|
||||||
import { onLoggedIn } from "~/composables/auth"
|
import { onLoggedIn } from "~/composables/auth"
|
||||||
@@ -374,4 +374,12 @@ const profile = ref<any | null>(null)
|
|||||||
const settings = ref<any | null>(null)
|
const settings = ref<any | null>(null)
|
||||||
const logout = ref<any | null>(null)
|
const logout = ref<any | null>(null)
|
||||||
const accountActions = ref<any | null>(null)
|
const accountActions = ref<any | null>(null)
|
||||||
|
|
||||||
|
defineActionHandler(
|
||||||
|
"user.login",
|
||||||
|
() => {
|
||||||
|
invokeAction("modals.login.toggle")
|
||||||
|
},
|
||||||
|
computed(() => !currentUser.value)
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex" @click="OpenLogoutModal()">
|
<div class="flex" @click="openLogoutModal()">
|
||||||
<HoppSmartItem
|
<HoppSmartItem
|
||||||
ref="logoutItem"
|
ref="logoutItem"
|
||||||
:icon="IconLogOut"
|
:icon="IconLogOut"
|
||||||
:label="`${t('auth.logout')}`"
|
:label="`${t('auth.logout')}`"
|
||||||
:outline="outline"
|
:outline="outline"
|
||||||
:shortcut="shortcut"
|
:shortcut="shortcut"
|
||||||
@click="OpenLogoutModal()"
|
@click="openLogoutModal()"
|
||||||
/>
|
/>
|
||||||
<HoppSmartConfirmModal
|
<HoppSmartConfirmModal
|
||||||
:show="confirmLogout"
|
:show="confirmLogout"
|
||||||
@@ -23,6 +23,7 @@ import IconLogOut from "~icons/lucide/log-out"
|
|||||||
import { useToast } from "@composables/toast"
|
import { useToast } from "@composables/toast"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { platform } from "~/platform"
|
import { platform } from "~/platform"
|
||||||
|
import { defineActionHandler } from "~/helpers/actions"
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
outline: {
|
outline: {
|
||||||
@@ -55,8 +56,12 @@ const logout = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const OpenLogoutModal = () => {
|
const openLogoutModal = () => {
|
||||||
emit("confirm-logout")
|
emit("confirm-logout")
|
||||||
confirmLogout.value = true
|
confirmLogout.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineActionHandler("user.logout", () => {
|
||||||
|
openLogoutModal()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user