diff options
-rw-r--r-- | app.js | 23 | ||||
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | views.js | 24 |
3 files changed, 26 insertions, 23 deletions
@@ -23,19 +23,20 @@ function route (keys) { input, h('button', { onclick: function () { - content = { - type: 'name', - named: id, - name: input.value - } - console.log('GETTING NAME') - publish(content, keys) - setTimeout(function () { - getName(id, keys) + if (input.value) { + content = { + type: 'name', + named: id, + name: input.value + } + publish(content, keys) setTimeout(function () { - location.reload() + getName(id, keys) + setTimeout(function () { + location.reload() + }, 1000) }, 1000) - }, 1000) + } } }, ['Identify']) ])) @@ -5,7 +5,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel='stylesheet' href='./css/source-sans-pro.min.css' /> <link rel='stylesheet' href='./css/style.css' /> - </head> + </head> <body> <script src="./lib/nacl.min.js"></script> <script src="./lib/nacl-util.min.js"></script> @@ -23,18 +23,20 @@ function profilePage (src, keys) { input, h('button', { onclick: function () { - content = { - type: 'name', - named: src, - name: input.value - } - localforage.removeItem('name:' + src) - publish(content, keys).then(post => { - open(post).then(msg => { - input.value = '' - scroller.insertBefore(render(msg, keys), scroller.childNodes[1]) + if (input.value) { + content = { + type: 'name', + named: src, + name: input.value + } + localforage.removeItem('name:' + src) + publish(content, keys).then(post => { + open(post).then(msg => { + input.value = '' + scroller.insertBefore(render(msg, keys), scroller.childNodes[1]) + }) }) - }) + } } }, ['Identify']) ]) |