aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-07-19 09:44:35 -0500
committerEv Bogue <ev@evbogue.com>2019-07-19 09:44:35 -0500
commit225132d80c2e60719d39ca95e0750f1dcf6dd54e (patch)
tree09d62ca4a78de696b8a0fd7325e71ee8cdfa787d
parent50aee6774fe47a6dc9a54d045cc6d4586b9ca677 (diff)
prevent blank identifications -- which seem to happen often
-rw-r--r--app.js23
-rw-r--r--index.html2
-rw-r--r--views.js24
3 files changed, 26 insertions, 23 deletions
diff --git a/app.js b/app.js
index 7371102..c15f2f2 100644
--- a/app.js
+++ b/app.js
@@ -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'])
]))
diff --git a/index.html b/index.html
index 59e731e..6a30f2f 100644
--- a/index.html
+++ b/index.html
@@ -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>
diff --git a/views.js b/views.js
index 8b5922d..56cee4a 100644
--- a/views.js
+++ b/views.js
@@ -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'])
])