From fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Thu, 4 Jun 2020 00:18:50 +0800
Subject: refactor(front): Make codes lint-clean!

---
 Timeline/ClientApp/src/home/TimelineCreateDialog.tsx | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'Timeline/ClientApp/src/home/TimelineCreateDialog.tsx')

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}`}
     />
   );
 };
-- 
cgit v1.2.3

