Cannot read properties of undefined (reading 'reachGoal')

This commit is contained in:
Zakhar
2026-09-05 10:59:33 +03:00
parent 0b76df4c81
commit b917f5df72
4 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ export function App() {
{showLoader && <Overlay><div /></Overlay>}
<LeftColumn $dataShow={!mobileShowFilters}>
<TitleBlock>
<h1>Кладило</h1>
<h1>Хватило</h1>
<MobileFilter onClick={() => setMobileShowFilters(true)}>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19 3V7M19 21V11M12 3V15M12 21V19M5 3V5M5 21V9" stroke="#5EA12D" strokeWidth="2" strokeLinecap="round"/>
+2 -2
View File
@@ -9,8 +9,8 @@ export const NotEnoughPopup = ({onClose}: any) => {
const [value, setValue] = useState('');
const [sent, setSent] = useState(false);
return <Overlay>
<Window>
return <Overlay onClick={() => onClose()}>
<Window onClick={event => event.stopPropagation()}>
<CloseButton type="button" aria-label="Закрыть" onClick={() => onClose()}>
&times;
</CloseButton>
+1 -7
View File
@@ -1,9 +1,3 @@
export const reachGoal = (goalName: string) => {
// @ts-ignore
if (typeof window.yaCounter68914120 !== undefined) {
// @ts-ignore
return window.yaCounter68914120.reachGoal(goalName);
}
return null;
return window.yaCounter68914120?.reachGoal?.(goalName);
};
+7
View File
@@ -0,0 +1,7 @@
interface YandexMetrikaCounter {
reachGoal(target: string, params?: any): void;
}
interface Window {
yaCounter68914120?: YandexMetrikaCounter;
}