From 3aa87cc26fd58836b82c067b58a47e08e30a7784 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 4 Jun 2020 00:18:50 +0800 Subject: refactor(front): Make codes lint-clean! --- Timeline/ClientApp/src/home/Home.tsx | 6 +++--- Timeline/ClientApp/src/home/TimelineCreateDialog.tsx | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'Timeline/ClientApp/src/home') diff --git a/Timeline/ClientApp/src/home/Home.tsx b/Timeline/ClientApp/src/home/Home.tsx index 25398a0a..495781d0 100644 --- a/Timeline/ClientApp/src/home/Home.tsx +++ b/Timeline/ClientApp/src/home/Home.tsx @@ -38,7 +38,7 @@ const Home: React.FC = (_) => { if (user == null) { setOwnTimelines(undefined); setJoinTimelines(undefined); - axios + void axios .get(`${apiBaseUrl}/timelines?visibility=public`) .then((res) => { if (subscribe) { @@ -47,7 +47,7 @@ const Home: React.FC = (_) => { }); } else { setPublicTimelines(undefined); - axios + void axios .get( `${apiBaseUrl}/timelines?relate=${user.username}&relateType=own` ) @@ -56,7 +56,7 @@ const Home: React.FC = (_) => { setOwnTimelines(res.data); } }); - axios + void axios .get( `${apiBaseUrl}/timelines?relate=${user.username}&relateType=join` ) 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 = props => { +const TimelineCreateDialog: React.FC = (props) => { const history = useHistory(); - const user = useUser()!; + const user = useUserLoggedIn(); let nameSaved: string; @@ -30,7 +30,7 @@ const TimelineCreateDialog: React.FC = 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 = 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