aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json4
-rw-r--r--src/Form/SignInForm.tsx10
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) {