diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-14 03:04:38 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-14 03:04:38 +0300 |
commit | f338f879a08945056dc6d35d3bb333e7d6cb0840 (patch) | |
tree | bb7ecb7fd156f22ea576cbb337c830efb0060243 | |
parent | 3969face39ecc933b1cb9c7625be921d148552cb (diff) | |
download | which-ui-f338f879a08945056dc6d35d3bb333e7d6cb0840.tar.gz |
style: resolve eslint errors
-rw-r--r-- | .eslintrc.json | 4 | ||||
-rw-r--r-- | src/Form/SignInForm.tsx | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 77aae50..75a787c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,11 +19,11 @@ "arrow-body-style": 0, "no-underscore-dangle": 0, "no-cond-assign": 0, + "no-nested-ternary": 0, "linebreak-style": 0, "react/prop-types": 0, "react/no-children-prop": 0, "react/no-danger": 0, - "react/jsx-one-expression-per-line": 0, - "prefer-destructuring": ["error", {"object": false, "array": true}] + "react/jsx-one-expression-per-line": 0 } } diff --git a/src/Form/SignInForm.tsx b/src/Form/SignInForm.tsx index 07e8f02..40352fe 100644 --- a/src/Form/SignInForm.tsx +++ b/src/Form/SignInForm.tsx @@ -24,7 +24,7 @@ const useStyles = makeStyles(theme => ({ const SignInForm: React.FC<PropTypes> = ({ setUser }) => { const classes = useStyles(); - const inputRef = useRef<any>(); + const inputRef = useRef<HTMLInputElement>(); const getUserProfile = name => { get(`/users?name=${name}`).then(response => { @@ -33,9 +33,11 @@ const SignInForm: React.FC<PropTypes> = ({ setUser }) => { }; const onClick = () => { - const value = inputRef.current.value; - localStorage.setItem('user', value); - getUserProfile(value); + const value = inputRef.current?.value; + if (value) { + localStorage.setItem('user', value); + getUserProfile(value); + } }; if (localStorage.getItem('user') !== null) { |