Created
          December 23, 2022 21:50 
        
      - 
      
- 
        Save SZharkov/d2337ed0540d8e779f2ab3bc9c60b7a9 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | async function fetchUserResources() { | |
| const [posts, photos, todos] = await Promise.allSettled([ | |
| fetch('https://jsonplaceholder.typicode.com/posts/1'), | |
| fetch('https://jsonplaceholder.typicode.com/photos/1'), | |
| fetch('https://jsonplaceholder.typicode.com/todos/1') | |
| ]); | |
| console.log(posts); | |
| // {status: "fulfilled", value: {"holds_the_posts_object"}} | |
| console.log(photos); | |
| // {status: "fulfilled", value: {"holds_the_photos_object"}} | |
| console.log(todos); | |
| // {status: "rejected", reason: The error} | |
| return {posts, photos, todos}; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment