File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 273273            } , 
274274            methods : { 
275275                async  fetchData ( )  { 
276-                     const  response  =  await  fetch ( 'https://countriesnow.space/api/v0.1/countries/' ) ; 
277-                     if ( response ) { 
276+                     const  response  =  await  fetch ( "https://api.sampleapis.com/countries/countries" ) ; 
277+ 
278+                     if  ( response . ok )  { 
278279                        const  data  =  await  response . json ( ) ; 
279-                         const  result  =  data . data ; 
280+                         const  countryNames  =  data . map ( ( country )  =>  country . name ) ; 
281+                         const  result  =  countryNames . sort ( ( a ,  b )  =>  a . localeCompare ( b ) ) ; 
280282
281-                         const  selectDrop  =  document . getElementById ( 'nationality' ) ; 
282-                         
283-                         result . forEach ( obj  =>  { 
284-                             viewmodel . nationalities . push ( obj . country ) ; 
285-                         } ) ; 
283+                         this . nationalities  =  result ; 
286284                    } 
287285                } , 
288286                click_character : function ( idx ,  type )  { 
454452
455453        } ) ; 
456454    </ script > 
457- </ html > 
455+ </ html > 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments