https error handling in domain

This commit is contained in:
akashnimare
2016-07-03 20:26:28 +05:30
parent 680c6ef338
commit 9e32deecc3
2 changed files with 5 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
window.location.href = 'https://' + data["domain"];
} else {
dialogs.prompt('Enter the URL for your Zulip server', function(url) {
url = url.replace(/^https?:\/\//,'')
db.push("/domain", url);
window.location.href = 'https://' + url ;
})

View File

@@ -11,7 +11,10 @@ function addDomain() {
const ipcRenderer = require('electron').ipcRenderer;
const JsonDB = require('node-json-db');
const db = new JsonDB('domain', true, true);
const newDomain = document.getElementById('url').value;
let newDomain = document.getElementById('url').value;
newDomain = newDomain.replace(/^https?:\/\//,'')
const domain = 'https://' + newDomain;
document.getElementById('urladded').innerHTML = newDomain + ' Added';