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/clone/wp-conte.../plugins/leadin/scripts/elemento.../FormWidg.../hooks
File: useForms.ts
import { useState, useEffect } from 'react';
[0] Fix | Delete
import LoadState, { LoadStateType } from '../../../shared/enums/loadState';
[1] Fix | Delete
import { ProxyMessages } from '../../../iframe/integratedMessages';
[2] Fix | Delete
import { usePostAsyncBackgroundMessage } from '../../../iframe/useBackgroundApp';
[3] Fix | Delete
import { IForm } from '../../../shared/types';
[4] Fix | Delete
[5] Fix | Delete
interface FormOption {
[6] Fix | Delete
label: string;
[7] Fix | Delete
value: string;
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
export default function useForms() {
[11] Fix | Delete
const proxy = usePostAsyncBackgroundMessage();
[12] Fix | Delete
const [loadState, setLoadState] = useState<LoadStateType>(
[13] Fix | Delete
LoadState.NotLoaded
[14] Fix | Delete
);
[15] Fix | Delete
const [hasError, setError] = useState(null);
[16] Fix | Delete
const [forms, setForms] = useState<FormOption[]>([]);
[17] Fix | Delete
[18] Fix | Delete
useEffect(() => {
[19] Fix | Delete
if (loadState === LoadState.NotLoaded) {
[20] Fix | Delete
proxy({
[21] Fix | Delete
key: ProxyMessages.FetchForms,
[22] Fix | Delete
payload: {
[23] Fix | Delete
search: '',
[24] Fix | Delete
},
[25] Fix | Delete
})
[26] Fix | Delete
.then(data => {
[27] Fix | Delete
setForms(
[28] Fix | Delete
data.map((form: IForm) => ({
[29] Fix | Delete
label: form.name,
[30] Fix | Delete
value: form.guid,
[31] Fix | Delete
}))
[32] Fix | Delete
);
[33] Fix | Delete
setLoadState(LoadState.Loaded);
[34] Fix | Delete
})
[35] Fix | Delete
.catch(error => {
[36] Fix | Delete
setError(error);
[37] Fix | Delete
setLoadState(LoadState.Failed);
[38] Fix | Delete
});
[39] Fix | Delete
}
[40] Fix | Delete
}, [loadState]);
[41] Fix | Delete
[42] Fix | Delete
return { forms, loading: loadState === LoadState.Loading, hasError };
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function