| 12345678910111213141516171819 |
- /**
- * This middleware preserve some global query parameters during the navigation,
- * like the theme color or the parent organization
- */
- const PRESERVE = ['parent', 'theme', 'view']
- export default function ({ from, route, redirect }) {
- let redirected = false
- for (const param in from.query) {
- if (PRESERVE.includes(param) && !(param in route.query)) {
- route.query[param] = from.query[param]
- redirected = true
- }
- }
- if (redirected) {
- redirect(route)
- }
- }
|