mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Defer rspamdUrl access
This commit is contained in:
@@ -5,17 +5,19 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAuthStore, useParametersStore } from '@/stores'
|
||||
import parametersApi from '@/api/parameters'
|
||||
import capabilitiesApi from '@/api/capabilities'
|
||||
import ConnectedLayout from '@/layouts/connected/ConnectedLayout.vue'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
const parametersStore = useParametersStore()
|
||||
|
||||
const isRspamdVisible = ref(false)
|
||||
const rspamd_url = ref('/rspamd')
|
||||
const rspamdUrl = ref('/rspamd')
|
||||
|
||||
const authUser = computed(() => authStore.authUser)
|
||||
const imapMigrationEnabled = computed(
|
||||
@@ -96,7 +98,7 @@ const adminMenuItems = [
|
||||
{
|
||||
icon: 'mdi-email-check-outline',
|
||||
text: 'Rspamd',
|
||||
to: rspamd_url.value,
|
||||
action: openRspamdDashboard,
|
||||
roles: ['SuperAdmins'],
|
||||
condition: () => isRspamdVisible.value,
|
||||
},
|
||||
@@ -128,9 +130,14 @@ onMounted(() => {
|
||||
capabilitiesApi.getCapabilities().then((response) => {
|
||||
isRspamdVisible.value = 'rspamd' in response.data.capabilities
|
||||
if (isRspamdVisible.value) {
|
||||
rspamd_url.value = response.data.capabilities.rspamd.location || '/rspamd'
|
||||
rspamd_url.value =
|
||||
response.data.capabilities.rspamd.location || '/rspamd'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const openRspamdDashboard = () => {
|
||||
router.push(rspamdUrl.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user