Skip to content

Commit 2120ac4

Browse files
committed
Update MockedData.stories.tsx
1 parent 9fe6b93 commit 2120ac4

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/components/src/stories/MockedData.stories.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ const DataFetcher = () => {
3232
const [data, setData] = useState<any>(null);
3333

3434
useEffect(() => {
35-
// Fetch from the mocked API
36-
fetch('/api/v1/data/contact/1')
37-
.then(res => res.json())
38-
.then(setData)
39-
.catch(e => console.error("Fetch failed", e));
35+
// Simulate a fetch call locally since MSW might not be configured in this environment
36+
const mockData = {
37+
name: "Sarah Connors",
38+
title: "Lead Engineer",
39+
company: "Cyberdyne Systems",
40+
email: "sarah@cyberdyne.com",
41+
status: "Active"
42+
};
43+
44+
const timer = setTimeout(() => {
45+
setData(mockData);
46+
}, 800);
47+
48+
return () => clearTimeout(timer);
4049
}, []);
4150

4251
if (!data) return <div className="p-4">Loading data from MSW...</div>;

0 commit comments

Comments
 (0)