Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/leadin/scripts/shared/Common
File: ErrorHandler.tsx
import React from 'react';
[0] Fix | Delete
import UIButton from '../UIComponents/UIButton';
[1] Fix | Delete
import UIContainer from '../UIComponents/UIContainer';
[2] Fix | Delete
import HubspotWrapper from './HubspotWrapper';
[3] Fix | Delete
import { adminUrl, redirectNonce } from '../../constants/leadinConfig';
[4] Fix | Delete
import { pluginPath } from '../../constants/leadinConfig';
[5] Fix | Delete
import { __ } from '@wordpress/i18n';
[6] Fix | Delete
[7] Fix | Delete
interface IErrorHandlerProps {
[8] Fix | Delete
status: number;
[9] Fix | Delete
resetErrorState?: React.MouseEventHandler<HTMLButtonElement>;
[10] Fix | Delete
errorInfo?: {
[11] Fix | Delete
header: string;
[12] Fix | Delete
message: string;
[13] Fix | Delete
action: string;
[14] Fix | Delete
};
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
function redirectToPlugin() {
[18] Fix | Delete
window.location.href = `${adminUrl}admin.php?page=leadin&leadin_expired=${redirectNonce}`;
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
export default function ErrorHandler({
[22] Fix | Delete
status,
[23] Fix | Delete
resetErrorState,
[24] Fix | Delete
errorInfo = { header: '', message: '', action: '' },
[25] Fix | Delete
}: IErrorHandlerProps) {
[26] Fix | Delete
const isUnauthorized = status === 401 || status === 403;
[27] Fix | Delete
const errorHeader = isUnauthorized
[28] Fix | Delete
? __("Your plugin isn't authorized", 'leadin')
[29] Fix | Delete
: errorInfo.header;
[30] Fix | Delete
const errorMessage = isUnauthorized
[31] Fix | Delete
? __('Reauthorize your plugin to access your free HubSpot tools', 'leadin')
[32] Fix | Delete
: errorInfo.message;
[33] Fix | Delete
[34] Fix | Delete
return (
[35] Fix | Delete
<HubspotWrapper pluginPath={pluginPath}>
[36] Fix | Delete
<UIContainer textAlign="center">
[37] Fix | Delete
<h4>{errorHeader}</h4>
[38] Fix | Delete
<p>
[39] Fix | Delete
<b>{errorMessage}</b>
[40] Fix | Delete
</p>
[41] Fix | Delete
{isUnauthorized ? (
[42] Fix | Delete
<UIButton data-test-id="authorize-button" onClick={redirectToPlugin}>
[43] Fix | Delete
{__('Go to plugin', 'leadin')}
[44] Fix | Delete
</UIButton>
[45] Fix | Delete
) : (
[46] Fix | Delete
<UIButton data-test-id="retry-button" onClick={resetErrorState}>
[47] Fix | Delete
{errorInfo.action}
[48] Fix | Delete
</UIButton>
[49] Fix | Delete
)}
[50] Fix | Delete
</UIContainer>
[51] Fix | Delete
</HubspotWrapper>
[52] Fix | Delete
);
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function