Skip to content
Snippets Groups Projects
Commit 58593433 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix circular route if opening app on login & started add duplicate type feature route

parent 100893db
No related branches found
No related tags found
No related merge requests found
......@@ -69,13 +69,20 @@ const routes = [
component: () => import('../views/project/Project_members.vue')
},
// * FEATURE TYPE
{
{
path: '/projet/:slug/type-signalement/ajouter/',
name: 'ajouter-type-signalement',
props: true,
hasProject: true,
component: () => import('../views/feature_type/Feature_type_edit.vue')
},
{
path: '/projet/:slug/type-signalement/ajouter/?create_from=:slug_type_signal',
name: 'dupliquer-type-signalement',
props: true,
hasProject: true,
component: () => import('../views/feature_type/Feature_type_edit.vue')
},
{
path: '/projet/:slug/type-signalement/:feature_type_slug/',
name: 'details-type-signalement',
......@@ -83,7 +90,7 @@ const routes = [
hasProject: true,
component: () => import('../views/feature_type/Feature_type_detail.vue')
},
{ // todo : adapter le template
{
path: '/projet/:slug/type-signalement/:slug_type_signal/editer/',
name: 'editer-type-signalement',
props: true,
......@@ -119,7 +126,7 @@ const routes = [
hasProject: true,
component: () => import('../views/feature/Feature_edit.vue')
},
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('../views/NotFound.vue') },
]
//let routerHistory = [];
......
......@@ -110,7 +110,9 @@ export default new Vuex.Store({
password: payload.password,
})
.then((response) => {
const routerHistory = router.options.routerHistory // * use store previous route to go back after login
console.log(router.options.routerHistory)
// * use stored previous route to go back after login if page not open on login at first
const routerHistory = router.options.routerHistory[0].name !== "login" ? router.options.routerHistory : "/"
commit("SET_USER", response.data.user);
router.push(routerHistory[routerHistory.length - 1] || "/")
dispatch("GET_USER_LEVEL_PROJECTS");
......
......@@ -185,10 +185,7 @@ export default {
data() {
return {
action:
this.$router.history.current.name === "ajouter-type-signalement"
? "create"
: "edit",
action: "create",
dataKey: 0,
form: {
colors_style: {
......@@ -277,6 +274,17 @@ export default {
"feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
this.slug_type_signal
);
if (this.$router.history.current.name === "ajouter-type-signalement") {
this.action = "create";
} else if (
this.$router.history.current.name === "editer-type-signalement"
) {
this.action = "edit";
} else if (
this.$router.history.current.name === "dupliquer-type-signalement"
) {
this.action = "duplicate";
}
},
mounted() {
if (this.action === "edit") {
......
......@@ -127,7 +127,11 @@
><!-- // todo : adapt -->
<i class="ui plus icon"></i>
</router-link>
<a
<router-link
:to="{
name: 'dupliquer-type-signalement',
params: { slug_type_signal: type.title },
}"
v-if="project && permissions.can_create_feature"
class="
ui
......@@ -141,10 +145,9 @@
data-tooltip="Dupliquer un type de signalement"
data-position="left center"
data-variation="mini"
href="{% url 'geocontrib:feature_type_create' slug=project.slug %}?create_from=type.slug"
><!-- // todo : adapt -->
<i class="inverted grey copy alternate icon"></i>
</a>
</router-link>
<router-link
:to="{
name: 'editer-type-signalement',
......@@ -163,7 +166,6 @@
data-tooltip="Éditer le type de signalement"
data-position="left center"
data-variation="mini"
href="{% url 'geocontrib:feature_type_update' slug=project.slug feature_type_slug=type.slug %}"
>
<i class="inverted grey pencil alternate icon"></i>
</router-link>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment