File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -25,20 +25,24 @@ function HelpDeskFullscreen() {
2525 } , [ fullscreenWidget , notificationsCount ] )
2626
2727 useEffect ( ( ) => {
28- if ( developerApp ) {
28+ if ( developerApp && developerApp . authorization ?. data ) {
2929 fetch ( `${ developerApp . urls . liveChatApi } /configuration/action/list_agents` , {
3030 method : 'POST' ,
3131 body : '{}' ,
3232 headers : {
3333 'Content-Type' : 'application/json' ,
34- Authorization : `${ developerApp . authorization ? .data ? .token_type } ${ developerApp . authorization ? .data ? .access_token } ` ,
34+ Authorization : `${ developerApp . authorization . data . token_type } ${ developerApp . authorization . data . access_token } ` ,
3535 } ,
3636 } )
3737 . then ( async ( response ) => {
38+ const data = await response . json ( ) ;
39+
3840 if ( response . ok ) {
39- return await response . json ( )
41+ return data
4042 }
4143
44+ await developerApp . features . reporting . sendError ( "4xx" , `Problem with agent list request [${ data . error ?. message ?? response . status } ]` )
45+
4246 return [ ]
4347 } )
4448 . then ( setAgents )
Original file line number Diff line number Diff line change @@ -25,20 +25,24 @@ function LiveChatFullscreen() {
2525 } , [ fullscreenWidget , notificationsCount ] )
2626
2727 useEffect ( ( ) => {
28- if ( developerApp ) {
28+ if ( developerApp && developerApp . authorization ?. data ) {
2929 fetch ( `${ developerApp . urls . liveChatApi } /configuration/action/list_agents` , {
3030 method : 'POST' ,
3131 body : '{}' ,
3232 headers : {
3333 'Content-Type' : 'application/json' ,
34- Authorization : `${ developerApp . authorization ? .data ? .token_type } ${ developerApp . authorization ? .data ? .access_token } ` ,
34+ Authorization : `${ developerApp . authorization . data . token_type } ${ developerApp . authorization . data . access_token } ` ,
3535 } ,
3636 } )
3737 . then ( async ( response ) => {
38+ const data = await response . json ( ) ;
39+
3840 if ( response . ok ) {
39- return await response . json ( )
41+ return data
4042 }
4143
44+ await developerApp . features . reporting . sendError ( "4xx" , `Problem with agent list request [${ data . error ?. message ?? response . status } ]` )
45+
4246 return [ ]
4347 } )
4448 . then ( setAgents )
You can’t perform that action at this time.
0 commit comments