function supportUserFn( { user, token, path, authorized } ) { const url = window.location.toString(); if ( url.indexOf( '?' ) > 0 ) { const cleanUrl = url.substring( 0, url.indexOf( '?' ) ); window.history.replaceState( {}, document.title, cleanUrl ); } if ( authorized ) { window.sessionStorage.setItem( 'boot_support_user', window.JSON.stringify( { user, token } ) ); } // Only redirect to same-domain const redirectUrl = new URL( url ); redirectUrl.pathname = path ? decodeURIComponent( path ) : '/'; redirectUrl.search = ''; window.location.replace( redirectUrl.href ); } function SupportUser( { supportUser, supportToken, supportPath, authorized = false } ) { return ( { /* eslint-disable react/no-danger */ }