Skip to content
Snippets Groups Projects
Commit 177ab409 authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'redmine-issues/13086' into 'develop'

REDMINE_ISSSUE-13086

See merge request !293
parents 13b4780c 1680906d
No related branches found
No related tags found
2 merge requests!295Version 3.0.0,!293REDMINE_ISSSUE-13086
......@@ -4,6 +4,10 @@ import Projects from '../views/Projects.vue';
Vue.use(VueRouter);
//* store initial route before redirect to login page
//* in order to turn back to shared project afterwards (not memorized in router history at page load)
window.initialRoute = window.location.href;
let projectBase = 'projet';
if (window.location.pathname.includes('projet-partage')) {
projectBase = 'projet-partage';
......@@ -18,10 +22,7 @@ const routes = [
{
path: '/connexion/',
name: 'login',
// route level code-splitting
// this generates a separate chunk (login.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "login" */'../views/registration/Login.vue')
component: () => import('../views/registration/Login.vue')
},
{
path: `${projectBase === 'projet' ? '': '/' + projectBase + '/:slug'}/my_account/`,
......@@ -137,14 +138,13 @@ const routes = [
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('../views/NotFound.vue') },
];
//let routerHistory = [];
const router = new VueRouter({
mode: 'history',
base: '/geocontrib/',
routes,
routerHistory: [],
scrollBehavior(to, from, savedPosition) { //* record each route change to turn back to origin after redirect
scrollBehavior(to, from, savedPosition) { //* record each route change to keep scroll position
const fromHistory = Boolean(savedPosition);
if (fromHistory && this.options.routerHistory.length > 0) {
......
......@@ -146,7 +146,13 @@ export default new Vuex.Store({
routerHistory = '/';
}
commit('SET_USER', response.data.user);
router.push(routerHistory[routerHistory.length - 1] || '/');
if (routerHistory === '/' && window.initialRoute.includes('projet-partage')) {
window.location.replace(window.initialRoute);
} else { // ToDo : not working at page load, routerHistory filled afterwards, could try history.back()
router.push(routerHistory[routerHistory.length - 1] || '/');
}
dispatch('GET_USER_LEVEL_PROJECTS');
dispatch('GET_USER_LEVEL_PERMISSIONS');
return response.status;
......
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