File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,13 +43,17 @@ reqButton.onclick = function() {
4343 . then ( res => res . json ( ) )
4444 // .then(json => console.log(json))
4545 . then ( addImages )
46- . catch ( error => reqStatus . innerHTML = error ) ;
46+ . catch ( error => {
47+ reqStatus . innerHTML = error ;
48+ reqButton . disabled = false ;
49+ } ) ;
4750
4851}
4952
5053function addImages ( jsonData )
5154{
5255 reqButton . disabled = false ;
56+
5357 if ( jsonData . error )
5458 {
5559 reqStatus . innerHTML = 'ERROR: ' + jsonData . error . message ;
Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ reqButton.onclick = function () {
5858 fetch ( gptEndpoint , reqParams )
5959 . then ( res => res . json ( ) )
6060 . then ( json => addText ( json , prompt ) )
61- . catch ( error => reqStatus . innerHTML = error )
61+ . catch ( error => {
62+ reqStatus . innerHTML = error ;
63+ reqButton . disabled = false ;
64+ } ) ;
6265}
6366
6467
You can’t perform that action at this time.
0 commit comments