# Redirect after login loses query params

**URL:** <https://meta.discourse.org/t/redirect-after-login-loses-query-params/121178>\
**Category:** Development\
**Created:** [June 24, 2019, 3:57pm UTC](https://meta.discourse.org/t/redirect-after-login-loses-query-params/121178 "2019-06-24T15:57:56Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![emanuele](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/emanuele/32/142687_2.png) [@emanuele](https://meta.discourse.org/u/emanuele)\
**Post date:** [June 24, 2019, 3:57pm UTC](https://meta.discourse.org/t/redirect-after-login-loses-query-params/121178/1 "2019-06-24T15:57:56Z")

</div>

This is my route code:

```plaintext
import { defaultHomepage } from "discourse/lib/utilities";

export default Discourse.Route.extend({
  beforeModel(transition) {
    if (!Discourse.User.current()) {
      $.cookie("destination_url", window.location.href);
      return this.replaceWith("login");
    }
    this.replaceWith(`/${defaultHomepage()}`).then(e => {
      Ember.run.next(() => {
        this.controllerFor("new-proof").send("openModal", transition.to.queryParams);
      });
    });
  },
});

```

The redirection _to_ the login page works well, but after login, I get redirected to the correct controller but _without the query parameters_ I had in the original request.

Is there a way around this that doesn’t involve using custom local storage entries/cookies? Am I doing something wrong?

---

_[View the full topic](https://meta.discourse.org/t/redirect-after-login-loses-query-params/121178)._
