diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-01-25 23:49:16 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-01-25 23:49:16 +0000 |
| commit | 65e10f07def87f0c4399dbce92eb00b430d5dba4 (patch) | |
| tree | 02d8646054b4f3647cee9938d82c2e9e3a70312b /src/components/mobile_nav/mobile_nav.js | |
| parent | a9716701be26c696ee1b908a1787b34880175ffa (diff) | |
| parent | c7c68340f1c8838cead855de3f624e0796fbc6c7 (diff) | |
Merge branch 'from/develop/tusooa/confirm-dialogs' into 'develop'
Confirmation dialogs
See merge request pleroma/pleroma-fe!1431
Diffstat (limited to 'src/components/mobile_nav/mobile_nav.js')
| -rw-r--r-- | src/components/mobile_nav/mobile_nav.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index cdbbb812..dad1f6aa 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -1,5 +1,6 @@ import SideDrawer from '../side_drawer/side_drawer.vue' import Notifications from '../notifications/notifications.vue' +import ConfirmModal from '../confirm_modal/confirm_modal.vue' import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils' import GestureService from '../../services/gesture_service/gesture_service' import NavigationPins from 'src/components/navigation/navigation_pins.vue' @@ -25,12 +26,14 @@ const MobileNav = { components: { SideDrawer, Notifications, - NavigationPins + NavigationPins, + ConfirmModal }, data: () => ({ notificationsCloseGesture: undefined, notificationsOpen: false, - notificationsAtTop: true + notificationsAtTop: true, + showingConfirmLogout: false }), created () { this.notificationsCloseGesture = GestureService.swipeGesture( @@ -57,7 +60,11 @@ const MobileNav = { ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']), chatsPinned () { return new Set(this.$store.state.serverSideStorage.prefsStorage.collections.pinnedNavItems).has('chats') - } + }, + shouldConfirmLogout () { + return this.$store.getters.mergedConfig.modalOnLogout + }, + ...mapGetters(['unreadChatCount']) }, methods: { toggleMobileSidebar () { @@ -88,9 +95,23 @@ const MobileNav = { scrollMobileNotificationsToTop () { this.$refs.mobileNotifications.scrollTo(0, 0) }, + showConfirmLogout () { + this.showingConfirmLogout = true + }, + hideConfirmLogout () { + this.showingConfirmLogout = false + }, logout () { + if (!this.shouldConfirmLogout) { + this.doLogout() + } else { + this.showConfirmLogout() + } + }, + doLogout () { this.$router.replace('/main/public') this.$store.dispatch('logout') + this.hideConfirmLogout() }, markNotificationsAsSeen () { // this.$refs.notifications.markAsSeen() |
