Skip to content

Commit 8ff2bf9

Browse files
committed
docs: Handle network error for nested user in post fixture
1 parent 501cb82 commit 8ff2bf9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

website/src/fixtures/posts.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@ export const postFixtures = [
150150
(post as any).author = user;
151151
return user;
152152
})
153-
.catch(e => {})
153+
.catch(e => {
154+
// fallback in case of failure
155+
const user = {
156+
id: post.author,
157+
name: 'Leanne Graham',
158+
};
159+
(post as any).author = user;
160+
return user;
161+
})
154162
: Promise.resolve({}),
155163
),
156164
);

0 commit comments

Comments
 (0)