mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
25 lines
684 B
JavaScript
25 lines
684 B
JavaScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
|
|
import routes from './routes';
|
|
import AnalyticsHelper from 'dashboard/helper/AnalyticsHelper';
|
|
import { validateRouteAccess } from '../helpers/RouteHelper';
|
|
|
|
export const router = createRouter({ history: createWebHistory(), routes });
|
|
|
|
const sensitiveRouteNames = ['auth_password_edit'];
|
|
|
|
export const initalizeRouter = () => {
|
|
router.beforeEach((to, _, next) => {
|
|
if (!sensitiveRouteNames.includes(to.name)) {
|
|
AnalyticsHelper.page(to.name || '', {
|
|
path: to.path,
|
|
name: to.name,
|
|
});
|
|
}
|
|
|
|
return validateRouteAccess(to, next, window.chatwootConfig);
|
|
});
|
|
};
|
|
|
|
export default router;
|