- added model IQueryRoute for made IQueryRoute list in queryRoutes.ts.

- improve and decomposited QueryRouter.
- updated router index block of modules and imports.
- updated version.
- build.
This commit is contained in:
Eugene Serb 2022-08-29 14:20:59 +03:00
parent c6e27be335
commit 0f720f2201
11 changed files with 64 additions and 31 deletions

View File

@ -15,4 +15,4 @@
webvisor: true
});</script><style>[v-cloak] {
display: none;
}</style><script defer="defer" src="/js/chunk-vendors.52df046b.js"></script><script defer="defer" src="/js/app.0de30deb.js"></script><link href="/css/app.e06e3290.css" rel="stylesheet"></head><body><div id="app" class="app" v-cloak></div><noscript>You need to enable JavaScript to run this app.</noscript><noscript><div><img src="https://mc.yandex.ru/watch/89252711" style="position:absolute; left:-9999px;" alt=""/></div></noscript></body></html>
}</style><script defer="defer" src="/js/chunk-vendors.52df046b.js"></script><script defer="defer" src="/js/app.9a519cb2.js"></script><link href="/css/app.e06e3290.css" rel="stylesheet"></head><body><div id="app" class="app" v-cloak></div><noscript>You need to enable JavaScript to run this app.</noscript><noscript><div><img src="https://mc.yandex.ru/watch/89252711" style="position:absolute; left:-9999px;" alt=""/></div></noscript></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
docs/js/app.9a519cb2.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "wavelovers",
"version": "1.0.8",
"version": "1.0.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "wavelovers",
"version": "1.0.8",
"version": "1.0.9",
"license": "GNU GPL v3",
"dependencies": {
"core-js": "^3.8.3",

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.8",
"version": "1.0.9",
"license": "GNU GPL v3",
"homepage": "https://wavelovers.ru/",
"author": {

View File

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

View File

@ -1,7 +1,11 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import {
createRouter, createWebHistory, RouteRecordRaw,
NavigationGuardNext, RouteLocationNormalized
} from 'vue-router';
import PatternsView from '@/views/PatternsView.vue';
import QueryRouter from '@/router/modules/QueryRouter';
import MetaTagUpdater from '@/router/modules/MetaTagUpdater';
import queryRoutes from '@/router/assets/queryRoutes';
const routes: Array<RouteRecordRaw> = [
{
@ -347,8 +351,14 @@ const router = createRouter({
routes,
});
router.beforeEach(QueryRouter.update);
router.beforeEach(MetaTagUpdater.update);
router.beforeEach((
to: RouteLocationNormalized,
from: RouteLocationNormalized,
next: NavigationGuardNext
) => {
QueryRouter.update(to, from, next, queryRoutes);
MetaTagUpdater.update(to, from, next)
});
export default router;

View File

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

View File

@ -1,31 +1,18 @@
import router from '@/router';
import { NavigationGuardNext, RouteLocationNormalized } from "vue-router";
import IQueryRoute from '@/router/models/IQueryRoute';
function updateRoute(
to: RouteLocationNormalized,
from: RouteLocationNormalized,
next: NavigationGuardNext
next: NavigationGuardNext,
queryRoutes: Array<IQueryRoute>
) {
switch (to.fullPath) {
case '/?custom':
router.push('/custom');
break;
case '/?manual':
router.push('/manual');
break;
case '/?diagnostic':
router.push('/diagnostic');
break;
case '/?faq':
router.push('/faq');
break;
case '/?about':
router.push('/about');
break;
case '/?donate':
router.push('/donate');
break;
}
queryRoutes.forEach((route) => {
if (route.query === to.fullPath) {
router.push(route.to);
}
});
return next();
}