From 526f5d3a2fc6a9bf5d20f8a34ca77acb4a3a9887 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 12 Dec 2019 15:11:37 +0300 Subject: Cleanup some tscheck warnings and remove remaining prop-types --- vnext/src/ui/Login.js | 4 ++-- vnext/src/ui/NavigationIcon.js | 5 ----- vnext/src/ui/SearchBox.js | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) (limited to 'vnext') diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js index 641ceb67..ff16d947 100644 --- a/vnext/src/ui/Login.js +++ b/vnext/src/ui/Login.js @@ -27,9 +27,9 @@ function Login({ visitor, onAuth }) { useEffect(() => { if (visitor.hash) { - const {retpath } = location.state; + const {retpath } = location.state || '/'; console.log(retpath); - history.push(retpath || '/'); + history.push(retpath); } }, [history, location.state, visitor]); diff --git a/vnext/src/ui/NavigationIcon.js b/vnext/src/ui/NavigationIcon.js index 9594d61f..41b95398 100644 --- a/vnext/src/ui/NavigationIcon.js +++ b/vnext/src/ui/NavigationIcon.js @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import Icon from './Icon'; @@ -24,7 +23,3 @@ function NavigationIcon(props) { export default React.memo(NavigationIcon); -NavigationIcon.propTypes = { - onToggle: PropTypes.func.isRequired -}; - diff --git a/vnext/src/ui/SearchBox.js b/vnext/src/ui/SearchBox.js index dda97989..005739d8 100644 --- a/vnext/src/ui/SearchBox.js +++ b/vnext/src/ui/SearchBox.js @@ -14,10 +14,7 @@ import { useFormState } from 'react-use-form-state'; * @param {SearchBoxProps} props */ function SearchBox({ onSearch }) { - /** - * @type {(React.FormEvent)} - */ - let onSubmit = (event) => { + let onSubmit = (/** @type React.FormEvent */ event) => { event.preventDefault(); onSearch(formState.values.search); }; -- cgit v1.2.3