Fixes loading of posts/profiles multiple times unnecessarily.
This commit is contained in:
parent
2d4608cb64
commit
32b81b94cf
2 changed files with 7 additions and 3 deletions
|
|
@ -317,7 +317,9 @@ when defined(js):
|
|||
if postId.isSome():
|
||||
params.add(("anchor", $postId.get()))
|
||||
let uri = makeUri("posts.json", params)
|
||||
ajaxGet(uri, @[], (s: int, r: kstring) => onPostList(s, r, postId))
|
||||
if not state.loading:
|
||||
state.loading = true
|
||||
ajaxGet(uri, @[], (s: int, r: kstring) => onPostList(s, r, postId))
|
||||
|
||||
return buildHtml(tdiv(class="loading loading-lg"))
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,10 @@ when defined(js):
|
|||
return renderError("Couldn't retrieve profile.", state.status)
|
||||
|
||||
if state.profile.isNone:
|
||||
let uri = makeUri("profile.json", ("username", username))
|
||||
ajaxGet(uri, @[], (s: int, r: kstring) => onProfile(s, r, state))
|
||||
if not state.loading:
|
||||
state.loading = true
|
||||
let uri = makeUri("profile.json", ("username", username))
|
||||
ajaxGet(uri, @[], (s: int, r: kstring) => onProfile(s, r, state))
|
||||
|
||||
return buildHtml(tdiv(class="loading loading-lg"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue