File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 273273            } , 
274274            methods : { 
275275                async  fetchData ( )  { 
276-                     const  response  =  await  fetch ( "https://api.sampleapis.com/countries/countries" ) ; 
277- 
276+                     const  response  =  await  fetch ( "https://restcountries.com/v3.1/all" ) ; 
278277                    if  ( response . ok )  { 
279-                         const  data  =  await  response . json ( ) ; 
280-                         const  countryNames  =  data . map ( ( country )  =>  country . name ) ; 
281-                         const  result  =  countryNames . sort ( ( a ,  b )  =>  a . localeCompare ( b ) ) ; 
278+                         const  countries  =  await  response . json ( ) ; 
279+                         const  result  =  countries . sort ( ( a ,  b )  =>  ( a . name . common  >  b . name . common  ? 1  : - 1 ) ) ; 
282280
283-                         this . nationalities  =  result ; 
281+                         result . forEach ( ( obj )  =>  { 
282+                             viewmodel . nationalities . push ( obj . name . common ) ; 
283+                         } ) ; 
284284                    } 
285285                } , 
286286                click_character : function ( idx ,  type )  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments