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

fix redirection after feature edition

parent 713be6a2
No related branches found
No related tags found
1 merge request!534REDMINE_ISSUE-15889|Edition d'un signalement - Redirection vers la page de détail ne fonctionne plus
......@@ -181,7 +181,7 @@ const feature = {
},
SEND_FEATURE({ state, rootState, commit, dispatch }, { routeName, query, extraForms }) {
function redirect(featureId, featureName, response) {
function redirect(featureName, response) {
// when modifying more than 2 features, exit this function (to avoid conflict with next feature call to GET_PROJECT_FEATURE)
if (routeName === 'editer-attribut-signalement') return response;
let newQuery = { ...query }; // create a copy of query from the route to avoid redundant navigation error since the router object would be modified
......@@ -197,9 +197,8 @@ const feature = {
);
const slug_type_signal = rootState['feature-type'].current_feature_type_slug;
const project = rootState.projects.project;
if (routeName === 'ajouter-signalement' && !query.ordering) {
const project = rootState.projects.project;
newQuery = {
ordering: project.feature_browsing_default_sort,
offset: 0,// if feature was just created, in both ordering it would be the first in project features list
......@@ -211,7 +210,10 @@ const feature = {
if (query && query.ordering === '-updated_on') { // if the list is ordered by update time
newQuery.offset = 0;// it would be in first position (else, if ordered by creation, the position won't change anyway)
}
if (parseInt(query.offset) === parseInt(newQuery.offset)) return 'reloadPage'; // in fast edition avoid redundant navigation if query didn't change
// in fast edition avoid redundant navigation if query didn't change
if (routeName === 'details-signalement-filtre' && parseInt(query.offset) === parseInt(newQuery.offset)) {
return 'reloadPage';
}
router.push({
name: 'details-signalement-filtre',
params: { slug_type_signal },
......@@ -223,7 +225,7 @@ const feature = {
async function handleOtherForms(featureId, featureName, response) {
await dispatch('SEND_ATTACHMENTS', featureId);
await dispatch('PUT_LINKED_FEATURES', featureId);
return redirect(featureId, featureName, response);
return redirect(featureName, response);
}
function createGeojson() { //* prepare feature data to send
......@@ -271,7 +273,7 @@ const feature = {
state.attachmentsToDelete.length > 0) {
return handleOtherForms(featureId, featureName, response);
} else {
return redirect(featureId, featureName, response);
return redirect(featureName, response);
}
}
})
......
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