diff options
author | Ev Bogue <ev@evbogue.com> | 2019-07-19 09:44:35 -0500 |
---|---|---|
committer | Ev Bogue <ev@evbogue.com> | 2019-07-19 09:44:35 -0500 |
commit | 225132d80c2e60719d39ca95e0750f1dcf6dd54e (patch) | |
tree | 09d62ca4a78de696b8a0fd7325e71ee8cdfa787d | |
parent | 50aee6774fe47a6dc9a54d045cc6d4586b9ca677 (diff) |
prevent blank identifications -- which seem to happen often
-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']) ]) |