diff options
author | crupest <crupest@outlook.com> | 2020-08-25 16:08:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 16:08:11 +0800 |
commit | c620d1d66757567f6b0f7abc66bc0f4c02be7ad3 (patch) | |
tree | 82a6b9acafdcad685fa306674cc934bd21d11280 /Timeline/ClientApp/src/app/user/User.tsx | |
parent | 738a17688ca481db62755295f8b732200ca12511 (diff) | |
parent | 201f75e0c339d3745a1fdb43a9579d502c447710 (diff) | |
download | timeline-c620d1d66757567f6b0f7abc66bc0f4c02be7ad3.tar.gz timeline-c620d1d66757567f6b0f7abc66bc0f4c02be7ad3.tar.bz2 timeline-c620d1d66757567f6b0f7abc66bc0f4c02be7ad3.zip |
Merge pull request #155 from crupest/nickname
Move change nickname api to UserInfoService.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/User.tsx')
-rw-r--r-- | Timeline/ClientApp/src/app/user/User.tsx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Timeline/ClientApp/src/app/user/User.tsx b/Timeline/ClientApp/src/app/user/User.tsx index 56058ce7..db0a6f76 100644 --- a/Timeline/ClientApp/src/app/user/User.tsx +++ b/Timeline/ClientApp/src/app/user/User.tsx @@ -5,7 +5,6 @@ import { UiLogicError } from "../common"; import { useUser, userInfoService } from "../data/user"; import TimelinePageTemplate from "../timeline/TimelinePageTemplate"; -import { changeNickname } from "./api"; import UserPage from "./UserPage"; import ChangeNicknameDialog from "./ChangeNicknameDialog"; import ChangeAvatarDialog from "./ChangeAvatarDialog"; @@ -17,7 +16,6 @@ const User: React.FC = (_) => { const user = useUser(); const [dialog, setDialog] = useState<null | PersonalTimelineManageItem>(null); - const [dataKey, setDataKey] = useState<number>(0); let dialogElement: React.ReactElement | undefined; @@ -34,12 +32,9 @@ const User: React.FC = (_) => { <ChangeNicknameDialog open close={closeDialogHandler} - onProcess={(newNickname) => { - const p = changeNickname(user.token, username, newNickname); - return p.then((_) => { - setDataKey(dataKey + 1); - }); - }} + onProcess={(newNickname) => + userInfoService.setNickname(username, newNickname) + } /> ); } else if (dialog === "avatar") { @@ -63,7 +58,6 @@ const User: React.FC = (_) => { return ( <> <TimelinePageTemplate - dataVersion={dataKey} name={`@${username}`} UiComponent={UserPage} onManage={onManage} |