- changed model IQueryRoute.

- changed name of queryRoutes to queries.
- modified QueryRouter for take router from arguments.
- modified router index.
This commit is contained in:
Eugene Serb 2022-08-29 15:28:18 +03:00
parent 0f720f2201
commit 0ad9753af0
5 changed files with 18 additions and 16 deletions

View File

@ -2,7 +2,7 @@
"name": "wavelovers",
"description": "Wavelovers. Use your device vibration correctly. Make a massager out of a gamepad.",
"keywords": [ "wavelovers", "gamepad-vibrator", "gamepad-test-tool", "gamepad-vibration-test-tool" ],
"version": "1.0.9",
"version": "1.0.10",
"license": "GNU GPL v3",
"homepage": "https://wavelovers.ru/",
"author": {

View File

@ -1,30 +1,30 @@
import IQueryRoute from '@/router/models/IQueryRoute';
const queryRoutes: Array<IQueryRoute> = [
const queries: Array<IQueryRoute> = [
{
query: '/?custom',
to: '/custom',
path: '/custom',
},
{
query: '/?manual',
to: '/manual',
path: '/manual',
},
{
query: '/?diagnostic',
to: '/diagnostic',
path: '/diagnostic',
},
{
query: '/?faq',
to: '/faq',
path: '/faq',
},
{
query: '/?about',
to: '/about',
path: '/about',
},
{
query: '/?donate',
to: '/donate',
path: '/donate',
}
];
export default queryRoutes;
export default queries;

View File

@ -5,7 +5,7 @@ import {
import PatternsView from '@/views/PatternsView.vue';
import QueryRouter from '@/router/modules/QueryRouter';
import MetaTagUpdater from '@/router/modules/MetaTagUpdater';
import queryRoutes from '@/router/assets/queryRoutes';
import queries from '@/router/assets/queries';
const routes: Array<RouteRecordRaw> = [
{
@ -356,7 +356,7 @@ router.beforeEach((
from: RouteLocationNormalized,
next: NavigationGuardNext
) => {
QueryRouter.update(to, from, next, queryRoutes);
QueryRouter.update(to, from, next, router, queries);
MetaTagUpdater.update(to, from, next)
});

View File

@ -1,6 +1,6 @@
interface IQueryRoute {
query: string;
to: string;
path: string;
}
export default IQueryRoute;

View File

@ -1,16 +1,18 @@
import router from '@/router';
import { NavigationGuardNext, RouteLocationNormalized } from "vue-router";
import {
Router, NavigationGuardNext, RouteLocationNormalized
} from "vue-router";
import IQueryRoute from '@/router/models/IQueryRoute';
function updateRoute(
to: RouteLocationNormalized,
from: RouteLocationNormalized,
next: NavigationGuardNext,
router: Router,
queryRoutes: Array<IQueryRoute>
) {
): void {
queryRoutes.forEach((route) => {
if (route.query === to.fullPath) {
router.push(route.to);
router.push(route.path);
}
});
return next();