File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
packages/components/src/stories Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff 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 > ;
You can’t perform that action at this time.
0 commit comments