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

disable redirect to feature details when editing in feature details, fix...

disable redirect to feature details when editing in feature details, fix anchor at scroll under header & remove dead code
parent 34de59da
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
<AppHeader />
<div id="app-content">
<span id="scroll-top-anchor" />
<div
:class="{ active: loader.isLoading }"
class="ui inverted dimmer"
......
......@@ -76,8 +76,8 @@ export default new Vuex.Store({
},
DISPLAY_MESSAGE(state, message) {
state.messages = [message, ...state.messages];
if (document.getElementById('app-content')) {
document.getElementById('app-content').scrollIntoView({ block: 'start', inline: 'nearest' });
if (document.getElementById('scroll-top-anchor')) {
document.getElementById('scroll-top-anchor').scrollIntoView({ block: 'start', inline: 'nearest' });
}
setTimeout(() => {
state.messages = [];
......
......@@ -176,8 +176,19 @@ const feature = {
});
},
SEND_FEATURE({ state, rootState, dispatch }, routeName) {
SEND_FEATURE({ state, rootState, commit, dispatch }, routeName) {
function redirect(featureId) {
commit(
'DISPLAY_MESSAGE',
{
comment: routeName === 'ajouter-signalement' ?
'Le signalement a été crée' :
'Le signalement a été mis à jour',
level: 'positive'
},
{ root: true },
);
if (routeName.includes('details-signalement')) return;
dispatch(
'GET_PROJECT_FEATURE',
{
......@@ -194,7 +205,6 @@ const feature = {
message: routeName === 'ajouter-signalement' ? 'Le signalement a été crée' : 'Le signalement a été mis à jour'
},
});
dispatch('projects/GET_ALL_PROJECTS', null, { root:true }); //* & refresh project list
});
}
......
......@@ -66,20 +66,6 @@ const projectsStore = {
},
actions: {
async GET_ALL_PROJECTS({ rootState, commit }) {
console.trace('GET_ALL_PROJECTS');
try {
const response = await axios
.get(`${rootState.configuration.VUE_APP_DJANGO_API_BASE}projects/`);
if (response.status === 200 && response.data) {
commit('SET_PROJECTS', response.data);
}
} catch (error) {
console.error(error);
throw error;
}
},
async GET_PROJECTS({ state, rootState, commit }, payload) {
let { page, myaccount, projectSlug } = payload || {};
if (!page) {
......
......@@ -229,7 +229,7 @@
import axios from '@/axios-client.js';
import Dropdown from '@/components/Dropdown.vue';
import { mapState, mapActions } from 'vuex';
import { mapState } from 'vuex';
export default {
name: 'ProjectEdit',
......@@ -352,9 +352,6 @@ export default {
},
methods: {
...mapActions('projects', [
'GET_ALL_PROJECTS'
]),
definePageType() {
if (this.$router.history.current.name === 'project_create') {
this.action = 'create';
......@@ -445,7 +442,6 @@ export default {
Promise.all([
this.$store.dispatch('GET_USER_LEVEL_PROJECTS'), //* refresh projects user levels
this.$store.dispatch('GET_USER_LEVEL_PERMISSIONS'), //* refresh projects permissions
this.GET_ALL_PROJECTS(), //* & refresh project list
]).then(() =>
// * go back to project list
this.$router.push({
......
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