[riot-mui] Add riot-mui in remove taf (#17)

When we remove the current server, it will update the view.
This commit is contained in:
Joxit 2017-09-29 21:08:19 +02:00
parent dc929951cf
commit ab0571eaa1
3 changed files with 30 additions and 31 deletions

View file

@ -18,7 +18,7 @@ var registryUI = {}
registryUI.URL_QUERY_PARAM_REGEX = /[&?]url=/;
registryUI.URL_PARAM_REGEX = /^url=/;
registryUI.url = function() {
registryUI.url = function(byPassQueryParam) {
if (!registryUI._url) {
var url = registryUI.getUrlQueryParam();
if (url) {
@ -78,10 +78,14 @@ registryUI.removeServer = function(url) {
}
registryServer.splice(index, 1);
localStorage.setItem('registryServer', JSON.stringify(registryServer));
if (url == registryUI.url()) {
registryUI.updateHistory(registryUI.getRegistryServer(0));
rg.router.go('home');
}
}
registryUI.updateHistory = function(url) {
history.pushState(null, '', '?url=' + registryUI.encodeURI(url) + window.location.hash);
history.pushState(null, '', (url ? '?url=' + registryUI.encodeURI(url) : '?') + window.location.hash);
registryUI._url = url;
}