Url Params with User Plugin

Hello,

We are developing a new app based on webix 5.4 pro and we use the User Plugin that when the status ajax call does not return the user session redirects to a login view.

The problem that we face is that when the user is not logged in we need to send a ?lang=en url param that the user plugin discards. We simplu cannot user any url param with the user plugin and the user logged out. The login view does not recieve any url param.

Any suggestion how to mantain the user plugin and send url params to the login view?

Thanks

If you have the incoming url like next

http://some.com/myapp?lang=en

login must redirect it to

//hash router
http://some.com/myapp?lang=en#/login
//url router
http://some.com/myapp?lang=en/login

While preserved, the lang parameter will not be accessible through Webix Jet API.
Though you can access those parameters through native API inside of app’s constructor. Then you can store lang data in app’s config, so it can be accessed in any view of the app

function getJsonFromUrl() {
  var query = location.search.substr(1);
  var result = {};
  query.split("&").forEach(function(part) {
    var item = part.split("=");
    result[item[0]] = decodeURIComponent(item[1]);
  });
  return result;
}

Hello Maksim,

While i was doing some tests, i ended up understanding that everything behind the hash was preserved, even when the user is logged out.
I took a similar approach using native js but with urlSerachParams:

const searchParams = new URLSearchParams(window.location);

It solved my problem too.

Thanks so much for the help, hope it helps someone in the future with the same problem.

Just for clarification i used a hash router and my url was:

http://localhost/webix-app/?lang=en#!/login

Thanks again