1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-10 00:43:53 +02:00
mailpit/server/ui-src/stores/mailbox.js

41 lines
1000 B
JavaScript

// State Management
import { reactive, watch } from 'vue'
// global mailbox info
export const mailbox = reactive({
total: 0, // total number of messages in database
unread: 0, // total unread messages in database
count: 0, // total in mailbox or search
messages: [], // current messages
tags: [], // all tags
showTagColors: true, // show/hide tag colors
selected: [], // currently selected
connected: false, // websocket connection
searching: false, // current search, false for none
refresh: false, // to listen from MessagesMixin
notificationsSupported: false,
notificationsEnabled: false,
appInfo: {}, // application information
uiConfig: {}, // configuration for UI
lastMessage: false, // return scrolling
})
watch(
() => mailbox.count,
(v) => {
mailbox.selected = []
}
)
watch(
() => mailbox.showTagColors,
(v) => {
if (v) {
localStorage.removeItem('hideTagColors')
} else {
localStorage.setItem('hideTagColors', '1')
}
}
)