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 /src | |
parent | 3969face39ecc933b1cb9c7625be921d148552cb (diff) | |
download | which-ui-f338f879a08945056dc6d35d3bb333e7d6cb0840.tar.gz |
style: resolve eslint errors
Diffstat (limited to 'src')
-rw-r--r-- | src/Form/SignInForm.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
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) { |