fix error message logic

load more should be displayed even when there is an error so the user
can retry.
This commit is contained in:
lilydjwg 2021-10-07 00:46:31 +08:00
parent befcf435d1
commit 685127fed2

View File

@ -58,6 +58,7 @@
query = info.get('q') query = info.get('q')
} }
if(group && query) { if(group && query) {
result = null
do_search() do_search()
} }
} }
@ -148,19 +149,20 @@
{/each} {/each}
{/if} {/if}
<div class="info">
{#if loading} {#if loading}
<p>正在加载...</p> <div class="info"><p>正在加载...</p></div>
{:else if error} {:else}
{#if error}
<p class="error">{error}</p> <p class="error">{error}</p>
{:else if result && result.messages.length == 0} {:else if result && result.messages.length == 0}
<p>没有匹配的消息。</p> <div class="info"><p>没有匹配的消息。</p></div>
{:else if result && result.has_more}
<button on:click={do_search_more}>加载更多</button>
{:else if result && !result.has_more} {:else if result && !result.has_more}
<p>到底了。</p> <div class="info"><p>到底了。</p></div>
{/if}
{#if result && result.has_more}
<div class="info"><button on:click={do_search_more}>加载更多</button></div>
{/if}
{/if} {/if}
</div>
</main> </main>
<style> <style>