mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-25 05:58:42 +01:00
Make sure to reset stores on logout
This commit is contained in:
@@ -14,6 +14,11 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
const accounts = ref({})
|
||||
const accountsLoaded = ref(false)
|
||||
|
||||
async function $reset() {
|
||||
accounts.value = {}
|
||||
accountsLoaded.value = false
|
||||
}
|
||||
|
||||
async function getAll() {
|
||||
accounts.value = {}
|
||||
return accountsApi.getAll().then((response) => {
|
||||
@@ -73,5 +78,6 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
updateAccount,
|
||||
createAccount,
|
||||
deleteAccount,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -10,9 +10,13 @@ export const useAliasesStore = defineStore('aliases', () => {
|
||||
const { $gettext } = gettext
|
||||
|
||||
const aliases = ref({})
|
||||
|
||||
const aliasesLoaded = ref(false)
|
||||
|
||||
async function $reset() {
|
||||
aliases.value = {}
|
||||
aliasesLoaded.value = false
|
||||
}
|
||||
|
||||
async function getAll() {
|
||||
aliasesLoaded.value = false
|
||||
return aliasesApi
|
||||
@@ -85,5 +89,6 @@ export const useAliasesStore = defineStore('aliases', () => {
|
||||
createAlias,
|
||||
deleteAlias,
|
||||
updateAlias,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,6 +6,11 @@ export const useBusStore = defineStore('bus', () => {
|
||||
const notification = ref({})
|
||||
const notificationColor = ref('')
|
||||
|
||||
async function $reset() {
|
||||
notification.value = {}
|
||||
notificationColor.value = ''
|
||||
}
|
||||
|
||||
function displayNotification(options) {
|
||||
notification.value = options.msg
|
||||
notificationColor.value = options.type ? options.type : 'success'
|
||||
@@ -14,5 +19,6 @@ export const useBusStore = defineStore('bus', () => {
|
||||
notification,
|
||||
notificationColor,
|
||||
displayNotification,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,6 +12,12 @@ export const useDomainsStore = defineStore('domains', () => {
|
||||
const domains = ref({})
|
||||
const domainAliases = ref({})
|
||||
|
||||
async function $reset() {
|
||||
domainsLoaded.value = false
|
||||
domains.value = {}
|
||||
domainAliases.value = {}
|
||||
}
|
||||
|
||||
async function getDomains() {
|
||||
domainsLoaded.value = false
|
||||
return domainApi.getDomains().then((response) => {
|
||||
@@ -144,5 +150,6 @@ export const useDomainsStore = defineStore('domains', () => {
|
||||
getAliases,
|
||||
deleteAlias,
|
||||
updateAlias,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -17,6 +17,11 @@ export const useIdentitiesStore = defineStore('identities', () => {
|
||||
const identitiesLoaded = ref(false)
|
||||
const identities = ref([])
|
||||
|
||||
async function $reset() {
|
||||
identitiesLoaded.value = false
|
||||
identities.value = []
|
||||
}
|
||||
|
||||
async function _getIndexByPk(type, pk) {
|
||||
for (let i = 0; i < identities.value.length; i++) {
|
||||
if (identities.value[i].pk === pk && identities.value[i].type === type) {
|
||||
@@ -168,5 +173,6 @@ export const useIdentitiesStore = defineStore('identities', () => {
|
||||
deleteIdentity,
|
||||
createIdentity,
|
||||
updateIdentity,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -4,5 +4,9 @@ import { ref } from 'vue'
|
||||
export const useParametersStore = defineStore('parameters', () => {
|
||||
const imapMigrationEnabled = ref(null)
|
||||
|
||||
return { imapMigrationEnabled }
|
||||
async function $reset() {
|
||||
imapMigrationEnabled.value = null
|
||||
}
|
||||
|
||||
return { imapMigrationEnabled, $reset }
|
||||
})
|
||||
|
||||
@@ -11,6 +11,11 @@ export const useProvidersStore = defineStore('providers', () => {
|
||||
const providers = ref({})
|
||||
const { $gettext } = gettext
|
||||
|
||||
async function $reset() {
|
||||
providersLoaded.value = false
|
||||
providers.value = {}
|
||||
}
|
||||
|
||||
async function getProviders() {
|
||||
providers.value = {}
|
||||
providersLoaded.value = false
|
||||
@@ -54,5 +59,6 @@ export const useProvidersStore = defineStore('providers', () => {
|
||||
getProviders,
|
||||
createProvider,
|
||||
deleteProvider,
|
||||
$reset
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user