empty list when loading

This commit is contained in:
Sebastian 2023-07-20 17:08:53 -03:00
parent c60f6c039a
commit 43f5572779
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
2 changed files with 3 additions and 4 deletions

View File

@ -87,7 +87,7 @@ export function Cases() {
if (!list.ok && !list.loading) { if (!list.ok && !list.loading) {
return handleNotOkResult(i18n)(list); return handleNotOkResult(i18n)(list);
} }
const records = list.loading ? [] : list.data.records
return ( return (
<div> <div>
<div class="px-4 sm:px-6 lg:px-8"> <div class="px-4 sm:px-6 lg:px-8">
@ -130,7 +130,7 @@ export function Cases() {
</div> </div>
<div class="mt-8 flow-root"> <div class="mt-8 flow-root">
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"> <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
{!list.data.records.length ? ( {!records.length ? (
<div>empty result </div> <div>empty result </div>
) : ( ) : (
<div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"> <div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
@ -159,7 +159,7 @@ export function Cases() {
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-gray-200 bg-white"> <tbody class="divide-y divide-gray-200 bg-white">
{list.data.records.map((r) => { {records.map((r) => {
return ( return (
<tr class="hover:bg-gray-100 "> <tr class="hover:bg-gray-100 ">
<td class="whitespace-nowrap px-3 py-5 text-sm text-gray-500 "> <td class="whitespace-nowrap px-3 py-5 text-sm text-gray-500 ">

View File

@ -158,7 +158,6 @@ interface useBackendType {
sandboxCashoutFetcher: <T>(endpoint: string[]) => Promise<HttpResponseOk<T>>; sandboxCashoutFetcher: <T>(endpoint: string[]) => Promise<HttpResponseOk<T>>;
} }
export function usePublicBackend(): useBackendType { export function usePublicBackend(): useBackendType {
const { state } = useBackendContext();
const { request: requestHandler } = useApiContext(); const { request: requestHandler } = useApiContext();
const baseUrl = getInitialBackendBaseURL(); const baseUrl = getInitialBackendBaseURL();