[dev] Reflect channel change in URL
It means that if I go to a channel and refresh the page, I will be reconnected to this channel after refresh.
This commit is contained in:
parent
5640c6c108
commit
eb8de9c2c2
|
@ -784,6 +784,11 @@ class GlobalBindings {
|
||||||
this.requestMove = (user, channel) => {
|
this.requestMove = (user, channel) => {
|
||||||
if (this.connected()) {
|
if (this.connected()) {
|
||||||
user.model.setChannel(channel.model)
|
user.model.setChannel(channel.model)
|
||||||
|
// reflect this change in URL
|
||||||
|
let currentUrl = url.parse(document.location.href, true)
|
||||||
|
currentUrl.query.channelName = channel.name()
|
||||||
|
delete currentUrl.search
|
||||||
|
window.history.pushState(null, channel.name(), url.format(currentUrl))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue