Added await

This commit is contained in:
Nicolai Ort 2021-08-16 16:50:20 +02:00
parent ca09aa0fd5
commit e031673e9c
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 26 additions and 6 deletions

View File

@ -33,26 +33,46 @@
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:text-gray-100" x-max="1">
{#each urls as url}
{#await urlQuery}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
{url.shortcode}
Loading data...
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<a href={url.target}>{url.target}</a>
<a href="#">Loading data...</a>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> {url.visits} </td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> Loading data... </td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button
on:click={deleteUrl(url.shortcode)}
class="text-indigo-600 dark:text-red-600 hover:text-indigo-900 dark:hover:text-red-900"
>Delete</button
>
</td>
</tr>
{/each}
{:then}
{#each urls as url}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
{url.shortcode}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<a href={url.target}>{url.target}</a>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> {url.visits} </td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button
on:click={deleteUrl(url.shortcode)}
class="text-indigo-600 dark:text-red-600 hover:text-indigo-900 dark:hover:text-red-900"
>Delete</button
>
</td>
</tr>
{/each}
{/await}
</tbody>
</table>
</div>