Commit d7221d981ca25931b54c37c514c78e9803027278
fix new follow loading button
mix irving committed on 1/28/2017, 2:30:45 AMParent: 78d39dc669df20b2f705b64f5de61c54906da3d2
Files changed
modules_basic/follow.js | changed |
modules_basic/follow.js | ||
---|---|---|
@@ -59,13 +59,13 @@ | ||
59 | 59 … | var follows_you, you_follow |
60 | 60 … | |
61 | 61 … | var self_id = require('../keys').id |
62 | 62 … | api.follower_of(self_id, id, (err, f) => { |
63 | - you_follow = f | |
63 … | + you_follow = f || false | |
64 | 64 … | update() |
65 | 65 … | }) |
66 | 66 … | api.follower_of(id, self_id, (err, f) => { |
67 | - follows_you = f | |
67 … | + follows_you = f || false | |
68 | 68 … | update() |
69 | 69 … | }) |
70 | 70 … | |
71 | 71 … | var followBtn = h('button', { 'ev-click': toggleFollow }, 'loading') |
@@ -78,8 +78,9 @@ | ||
78 | 78 … | : you_follow ? '- you are following' |
79 | 79 … | : '' |
80 | 80 … | ) |
81 | 81 … | |
82 … | + // wait till finished loading before offering follow options | |
82 | 83 … | if (you_follow === undefined) return |
83 | 84 … | followBtn.textContent = you_follow ? 'unfollow' : 'follow' |
84 | 85 … | } |
85 | 86 … | |
@@ -98,9 +99,9 @@ | ||
98 | 99 … | |
99 | 100 … | api.message_confirm(msg, (err, msg) => { |
100 | 101 … | if (err) return console.error(err) |
101 | 102 … | |
102 | - you_follow = msg.value.content.following | |
103 … | + you_follow = !you_follow | |
103 | 104 … | update() |
104 | 105 … | }) |
105 | 106 … | } |
106 | 107 … |
Built with git-ssb-web