[UI] dialog and redirect for no active domain

This commit is contained in:
xue jiahao
2024-11-27 16:01:18 +08:00
parent df5b012bcd
commit 024645e16a
7 changed files with 59 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ import {
createWebHashHistory,
createWebHistory,
} from 'vue-router';
import { Dialog } from 'quasar'
import routes from './routes';
import { useAuthStore } from 'stores/useAuthStore';
@@ -47,6 +48,20 @@ export default route(function (/* { store, ssrContext } */) {
authStore.returnUrl = to.fullPath;
return '/login';
}
// redirect to domain setting page if no domain exist
const domainPages = [...publicPages, '/domain', '/userDomain', '/user'];
if (!authStore.hasDomain && !domainPages.includes(to.path)) {
Dialog.create({
title: '注意',
message: '既定/利用可能なドメインはありません。<br>ドメイン管理ページに遷移して処理します。',
html: true,
persistent: true,
}).onDismiss(() => {
console.log('Dialog dismissed. You can do some clean up here')
})
return '/domain';
}
});
return routerInstance;
});