Skip to content

Commit 603fb48

Browse files
committed
fix: add error handling to source article fetching in multiple card components
1 parent 7cb791c commit 603fb48

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

src/features/cards/components/conferencesCard/ConferencesCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ export function ConferencesCard(props: CardPropsType) {
2121
source: meta.value,
2222
fallbackTag: GLOBAL_TAG,
2323
})
24-
const { isLoading, data: results } = useGetConferences({
24+
const {
25+
isLoading,
26+
error,
27+
data: results,
28+
} = useGetConferences({
2529
tags: queryTags,
2630
config: {
2731
enabled: isVisible,
@@ -59,6 +63,7 @@ export function ConferencesCard(props: CardPropsType) {
5963
<ListConferenceComponent
6064
sortBy={sortBy as keyof Conference}
6165
items={results}
66+
error={error}
6267
isLoading={isLoading}
6368
renderItem={renderItem}
6469
/>

src/features/cards/components/freecodecampCard/FreecodecampCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function FreecodecampCard(props: CardPropsType) {
2323
fallbackTag: GLOBAL_TAG,
2424
})
2525

26-
const { data, isLoading } = useGetSourceArticles({
26+
const { data, error, isLoading } = useGetSourceArticles({
2727
source: 'freecodecamp',
2828
tags: queryTags,
2929
config: {
@@ -56,6 +56,7 @@ export function FreecodecampCard(props: CardPropsType) {
5656
<ListPostComponent
5757
sortBy={sortBy as keyof Article}
5858
items={data}
59+
error={error}
5960
isLoading={isLoading}
6061
renderItem={renderItem}
6162
/>

src/features/cards/components/hackernoonCard/HackernoonCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function HackernoonCard(props: CardPropsType) {
2323
fallbackTag: GLOBAL_TAG,
2424
})
2525

26-
const { data, isLoading } = useGetSourceArticles({
26+
const { data, error, isLoading } = useGetSourceArticles({
2727
source: 'hackernoon',
2828
tags: queryTags,
2929
config: {
@@ -55,6 +55,7 @@ export function HackernoonCard(props: CardPropsType) {
5555
{...props}>
5656
<ListPostComponent
5757
sortBy={sortBy as keyof Article}
58+
error={error}
5859
items={data}
5960
isLoading={isLoading}
6061
renderItem={renderItem}

src/features/cards/components/hashnodeCard/HashnodeCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function HashnodeCard(props: CardPropsType) {
2424
source: meta.value,
2525
fallbackTag: GLOBAL_TAG,
2626
})
27-
const { data, isLoading } = useGetSourceArticles({
27+
const { data, error, isLoading } = useGetSourceArticles({
2828
source: 'hashnode',
2929
tags: queryTags,
3030
config: {
@@ -68,6 +68,7 @@ export function HashnodeCard(props: CardPropsType) {
6868
{...props}>
6969
<ListComponent<Article>
7070
sortBy={sortBy as keyof Article}
71+
error={error}
7172
items={data}
7273
isLoading={isLoading}
7374
renderItem={renderItem}

src/features/cards/components/mediumCard/MediumCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function MediumCard(props: CardPropsType) {
2424
source: meta.value,
2525
fallbackTag: GLOBAL_TAG,
2626
})
27-
const { data, isLoading } = useGetSourceArticles({
27+
const { data, isLoading, error } = useGetSourceArticles({
2828
source: 'medium',
2929
tags: queryTags,
3030
config: {
@@ -76,6 +76,7 @@ export function MediumCard(props: CardPropsType) {
7676
<ListPostComponent
7777
sortBy={sortBy as keyof Article}
7878
items={data}
79+
error={error}
7980
isLoading={isLoading}
8081
renderItem={renderItem}
8182
/>

0 commit comments

Comments
 (0)