Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
format data if not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
SmashinFries committed Jun 22, 2022
1 parent a9f606e commit 24219f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/navigation/tabs/listTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export const ListTabs = ({ navigation, route }: ListTabProp) => {

const filterData = (status: string) => {
const statusData = data?.lists.filter((item) => item.status === status);
let formattedData = (statusData.length > 0) ? statusData[0].entries : [];
if (format === 'NOVEL' || format === 'MANGA') {
formattedData = statusData[0].entries.filter((item: MediaCollectionEntries) => {
let formattedData = (statusData.length > 0 && statusData[0].entries !== undefined) ? statusData[0].entries : [];
if (format === 'NOVEL' || format === 'MANGA' && formattedData.length > 0) {
formattedData = formattedData.filter((item: MediaCollectionEntries) => {
if (format === 'MANGA') return(item.media.format !== 'NOVEL');
return (item.media.format === format);
});
Expand All @@ -72,7 +72,7 @@ export const ListTabs = ({ navigation, route }: ListTabProp) => {
return ({ data: filterData(listStatus.toUpperCase()), listStatus: listStatus, colors: { colors, dark } });
}

if (listLoad) return <LoadingView colors={{ colors, dark }} titleData={[{ title: 'Fetching List', loading: listLoad }]} />
if (listLoad) return <LoadingView colors={colors} titleData={[{ title: 'Fetching List', loading: listLoad }]} />

return (
<View style={{ height: '100%' }} collapsable={false}>
Expand Down

0 comments on commit 24219f0

Please sign in to comment.