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 | 3aa87cc26fd58836b82c067b58a47e08e30a7784 (patch) | |
tree | ba9cf1918d210896ab10bed484a8ddf7c7935e0c /Timeline/ClientApp/src/settings/Settings.tsx | |
parent | 1e90a93049cd57098608de72f02bfaabfadd32b6 (diff) | |
download | timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.gz timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.bz2 timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.zip |
refactor(front): Make codes lint-clean!
Diffstat (limited to 'Timeline/ClientApp/src/settings/Settings.tsx')
-rw-r--r-- | Timeline/ClientApp/src/settings/Settings.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Timeline/ClientApp/src/settings/Settings.tsx b/Timeline/ClientApp/src/settings/Settings.tsx index b3996fdc..075f8699 100644 --- a/Timeline/ClientApp/src/settings/Settings.tsx +++ b/Timeline/ClientApp/src/settings/Settings.tsx @@ -6,12 +6,13 @@ import { Container, Row, Col, Input } from 'reactstrap'; import { apiBaseUrl } from '../config';
-import { useUser, userLogout } from '../data/user';
+import { useUser, userLogout, useUserLoggedIn } from '../data/user';
import AppBar from '../common/AppBar';
import OperationDialog, {
OperationInputErrorInfo,
} from '../common/OperationDialog';
+import { CommonErrorResponse } from '../data/common';
interface ChangePasswordDialogProps {
open: boolean;
@@ -30,7 +31,7 @@ async function changePassword( newPassword,
});
} catch (e) {
- const error = e as AxiosError;
+ const error = e as AxiosError<CommonErrorResponse>;
if (
error.response &&
error.response.status === 400 &&
@@ -44,7 +45,7 @@ async function changePassword( }
const ChangePasswordDialog: React.FC<ChangePasswordDialogProps> = (props) => {
- const user = useUser()!;
+ const user = useUserLoggedIn();
const history = useHistory();
const { t } = useTranslation();
@@ -176,7 +177,7 @@ const Settings: React.FC = (_) => { type="select"
value={language}
onChange={(e) => {
- i18n.changeLanguage(e.target.value);
+ void i18n.changeLanguage(e.target.value);
}}
>
<option value="zh">中文</option>
|