diff options
author | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
commit | fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0 (patch) | |
tree | 787cda66f8997ba842601a261a36b6de95398675 /Timeline/ClientApp/src/home/TimelineCreateDialog.tsx | |
parent | 92e50c4a3ea250dc18c76bc8c29d86d486e63772 (diff) | |
download | timeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.tar.gz timeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.tar.bz2 timeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.zip |
refactor(front): Make codes lint-clean!
Diffstat (limited to 'Timeline/ClientApp/src/home/TimelineCreateDialog.tsx')
-rw-r--r-- | Timeline/ClientApp/src/home/TimelineCreateDialog.tsx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Timeline/ClientApp/src/home/TimelineCreateDialog.tsx b/Timeline/ClientApp/src/home/TimelineCreateDialog.tsx index 30d29bc8..27c9d0d6 100644 --- a/Timeline/ClientApp/src/home/TimelineCreateDialog.tsx +++ b/Timeline/ClientApp/src/home/TimelineCreateDialog.tsx @@ -3,7 +3,7 @@ import { useHistory } from 'react-router'; import axios from 'axios';
import { apiBaseUrl } from '../config';
-import { useUser } from '../data/user';
+import { useUserLoggedIn } from '../data/user';
import { validateTimelineName } from '../data/timeline';
import OperationDialog from '../common/OperationDialog';
@@ -13,9 +13,9 @@ interface TimelineCreateDialogProps { close: () => void;
}
-const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = props => {
+const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = (props) => {
const history = useHistory();
- const user = useUser()!;
+ const user = useUserLoggedIn();
let nameSaved: string;
@@ -30,7 +30,7 @@ const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = props => { type: 'text',
label: 'home.createDialog.name',
helperText: 'home.createDialog.nameFormat',
- validator: name => {
+ validator: (name) => {
if (name.length === 0) {
return 'home.createDialog.noEmpty';
} else if (name.length > 26) {
@@ -40,19 +40,19 @@ const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = props => { } else {
return null;
}
- }
- }
+ },
+ },
]}
onProcess={([name]) => {
nameSaved = name as string;
return axios.post(`${apiBaseUrl}/timelines?token=${user.token}`, {
- name
+ name,
});
}}
onSuccessAndClose={() => {
history.push(`timelines/${nameSaved}`);
}}
- failurePrompt={e => (e as object).toString()}
+ failurePrompt={(e) => `${e as string}`}
/>
);
};
|