mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-26 17:56:13 -04:00
fix: prevented routes duplicates du to i18n
This commit is contained in:
parent
d50cbf263c
commit
55a1d130a0
4 changed files with 8 additions and 4 deletions
|
@ -9,7 +9,7 @@ export class ToolRoutesMixin extends Vue {
|
|||
toolRoutesSections : {[key: string]: ToolRouteConfig[]} = {}
|
||||
|
||||
async created() {
|
||||
const routes = this.$router.options.routes?.filter(r => r.meta?.isTool) || []
|
||||
const routes = this.$router.options.routes?.filter((r1, i, a) => r1.meta?.isTool && a.findIndex(r2 => r2.path.split('/').pop() === r1.path.split('/').pop()) === i) || []
|
||||
const flat: ToolRouteConfig[] = []
|
||||
const sections: { [key: string]: ToolRouteConfig[] } = {}
|
||||
|
||||
|
@ -17,6 +17,7 @@ export class ToolRoutesMixin extends Vue {
|
|||
if ('component' in route) {
|
||||
// @ts-ignore
|
||||
const component = await route.component()
|
||||
|
||||
const routeConfig = {...route, config: component.options.methods.config()} as ToolRouteConfig
|
||||
flat.push(routeConfig)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue