@@ -374,25 +374,26 @@ export const AppAPIProvider: Component<Context> = (props) => {
374
374
} )
375
375
const config_json = JSON . parse ( config )
376
376
trace ( `[Config]: ${ JSON . stringify ( config_json ) } ` )
377
- if ( response instanceof Object && response . ok ) {
378
- if ( config !== '' ) {
379
- if ( response . data [ 'name' ] !== config_json . version ) {
380
- // update config
381
- setGHData ( response . data , true )
382
- debug (
383
- '[Config Exists]: Config Exists and is out of date - Updating' ,
384
- )
385
- setGHRestStatus ( RESTStatus . COMPLETE )
386
- return
387
- }
388
- }
377
+ if (
378
+ ( ! response . ok || ! ( response instanceof Object ) ) &&
379
+ config === ''
380
+ ) {
381
+ warn ( '[Config Exists]: Most likely rate limited' )
382
+ setGHData ( config_json , false )
383
+ setGHRestStatus ( RESTStatus . COMPLETE )
384
+ return
385
+ }
386
+ if ( response . data [ 'name' ] === config_json . version ) {
389
387
debug ( '[Config Exists]: Config Exists and is up to date' )
390
388
setGHData ( response . data , false )
391
389
return
392
390
}
393
- warn ( '[Config Exists]: Most likely rate limited' )
394
- setGHData ( config_json , false )
391
+
392
+ // update config
393
+ setGHData ( response . data , true )
394
+ debug ( '[Config Exists]: Config Exists and is out of date - Updating' )
395
395
setGHRestStatus ( RESTStatus . COMPLETE )
396
+ return
396
397
} catch ( err ) {
397
398
setGHRestStatus ( RESTStatus . NO_CONFIG )
398
399
if ( response . ok ) {
@@ -447,7 +448,7 @@ export const AppAPIProvider: Component<Context> = (props) => {
447
448
}
448
449
}
449
450
450
- const RequestHook = async (
451
+ const useRequestHook = async (
451
452
endpointName : string ,
452
453
deviceName ?: string ,
453
454
args ?: string ,
@@ -487,10 +488,6 @@ export const AppAPIProvider: Component<Context> = (props) => {
487
488
}
488
489
}
489
490
490
- const useRequestHook = async ( endpointName : string , deviceName ?: string , args ?: string ) => {
491
- await RequestHook ( endpointName , deviceName , args )
492
- }
493
-
494
491
/**
495
492
* @description Uploads a firmware to a device
496
493
* @param firmwareName The name of the firmware file
0 commit comments