Commit 7cb739a8 authored by Manuel Tancoigne's avatar Manuel Tancoigne

Update router to handle :locale/:file urls

parent 39b217bf
<template>
<i-list-group-item>
<h4>
<router-link :to="{ name: 'renderer', params: { content: file} }">{{ template.name }}</router-link>
<router-link :to="{ name: 'renderer', params: { locale, file } }">
{{ template.name }}
</router-link>
</h4>
<dl class="infos infos--inline">
<div v-if="showLanguage" class="infos-item">
......
......@@ -20,7 +20,7 @@ export default new Router({
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),
},
{
path: '/complete/:content',
path: '/complete/:locale/:file',
name: 'renderer',
component: () => import(/* webpackChunkName: "renderer" */ './views/Renderer.vue'),
},
......
......@@ -345,9 +345,11 @@ export default {
},
},
created () {
if (templates.hasOwnProperty(this.$route.params.content)) {
this.templateMeta = templates[this.$route.params.content]
fetch(`/templates/${this.$route.params.content}`)
const locale = this.$route.params.locale
const file = this.$route.params.file
if (templates[locale] && templates[locale][file]) {
this.templateMeta = templates[locale][file]
fetch(`/templates/${locale}/${file}`)
.then((response) => {
return response.blob()
.then(async (blob) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment