Cannot read properties of undefined (reading 'reachGoal')
This commit is contained in:
parent
0b76df4c81
commit
b917f5df72
@ -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"/>
|
||||
|
||||
@ -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()}>
|
||||
×
|
||||
</CloseButton>
|
||||
|
||||
@ -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
src/types.d.ts
vendored
Normal file
7
src/types.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
interface YandexMetrikaCounter {
|
||||
reachGoal(target: string, params?: any): void;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
yaCounter68914120?: YandexMetrikaCounter;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user