This repository was archived by the owner on May 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 var xhr = new XMLHttpRequest ( ) ;
55 xhr . open ( 'GET' , 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100%27' ) ;
66 xhr . onload = function ( ) {
7+
78 if ( this . status == 200 ) {
89 var repos = JSON . parse ( this . responseText ) ;
910 var output = '' ;
1213 }
1314 document . getElementById ( 'reposs' ) . innerHTML = output ;
1415
16+ } else {
17+ document . getElementById ( 'users' ) . classList . add ( 'NetwrkError' ) ;
18+ document . getElementById ( 'users' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
1519 }
20+
21+ }
22+ xhr . onerror = function ( ) {
23+ document . getElementById ( 'users' ) . classList . add ( 'NetwrkError' ) ;
24+ document . getElementById ( 'users' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
1625 }
1726
1827 xhr . send ( ) ;
@@ -58,6 +67,10 @@ function loadUsers() {
5867 document . getElementById ( 'users' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
5968 }
6069 }
70+ xhr . onerror = function ( ) {
71+ document . getElementById ( 'users' ) . classList . add ( 'NetwrkError' ) ;
72+ document . getElementById ( 'users' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
73+ }
6174
6275 xhr . send ( ) ;
6376
@@ -98,6 +111,10 @@ function loadUsers2(){
98111 document . getElementById ( 'users2' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
99112 }
100113 }
114+ xhr . onerror = function ( ) {
115+ document . getElementById ( 'users2' ) . classList . add ( 'NetwrkError' ) ;
116+ document . getElementById ( 'users2' ) . innerHTML = "Netwrk error:" + this . status + ' - ' + this . statusText ;
117+ }
101118
102119 xhr . send ( ) ;
103120}
You can’t perform that action at this time.
0 commit comments