store.commit('CLEAR_MESSAGES');// Remove other messages to avoid displaying twice that the user is not connected
store.commit('DISPLAY_MESSAGE',{comment:`Vous n'avez pas accès à ce signalement ${store.state.user?'avec cet utilisateur':'hors connexion, veuillez-vous connecter au préalable'}`,level:'negative'});
// API return no content when user is not allowed to see the feature or isn't connected
if (store.state.user){
// If the user is connected, display information that he's not allowed to view the feature
store.commit('DISPLAY_MESSAGE',{comment:'Vous n\'avez pas accès à ce signalement avec cet utilisateur',level:'negative'});
// and redirect to main page
next({path:'/'});
}else{
next({name:'login'});
// If the user is not connected, remove other messages to avoid displaying twice that the user is not connected
store.commit('CLEAR_MESSAGES');
// display information that user need to be connected
store.commit('DISPLAY_MESSAGE',{comment:'Vous n\'avez pas accès à ce signalement hors connexion, veuillez-vous connecter au préalable',level:'negative'});
// Then redirect to login page
if (store.state.configuration.VUE_APP_LOGIN_URL){
// If the login is through SSO, redirect to external login page (if the instance accepts a redirect_url it would be caught before when requesting user_info with GET_USER_INFO)
setTimeout(()=>{// delay switching page to allow the info message to be read by user