Better indentation

This commit is contained in:
Dan Q 2023-09-28 16:09:44 +01:00
parent b050266d61
commit 6ffdda2ff7
1 changed files with 14 additions and 13 deletions

View File

@ -37,19 +37,20 @@ async function fetchJsonWithCache( url: string ): Promise< any > {
// Failing that, fetch from net:
return new Promise( ( resolve, reject ) => {
fetch( url ).then( ( response ) => {
if ( ! response.ok ) {
throw new Error( response.statusText );
}
return response.json();
} )
.then( ( json ) => {
fetchCache[ url ] = json;
resolve( json );
} )
.catch( () => {
reject();
} );
fetch( url )
.then( ( response ) => {
if ( ! response.ok ) {
throw new Error( response.statusText );
}
return response.json();
} )
.then( ( json ) => {
fetchCache[ url ] = json;
resolve( json );
} )
.catch( () => {
reject();
} );
} );
}