aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/data
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-25 16:08:11 +0800
committerGitHub <noreply@github.com>2020-08-25 16:08:11 +0800
commit03ad387a8d71545995c0cc91bfb64acd388529f7 (patch)
tree15dc77bbff09925a6e7fdce164c46c2d7ff441f3 /Timeline/ClientApp/src/app/data
parent2867b65d2215ea89cca0e5c5cfbb536d08f60263 (diff)
parent534bb6739d0d217c2b075834a2642092522cc5fd (diff)
downloadtimeline-03ad387a8d71545995c0cc91bfb64acd388529f7.tar.gz
timeline-03ad387a8d71545995c0cc91bfb64acd388529f7.tar.bz2
timeline-03ad387a8d71545995c0cc91bfb64acd388529f7.zip
Merge pull request #155 from crupest/nickname
Move change nickname api to UserInfoService.
Diffstat (limited to 'Timeline/ClientApp/src/app/data')
-rw-r--r--Timeline/ClientApp/src/app/data/user.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/data/user.ts b/Timeline/ClientApp/src/app/data/user.ts
index ceabdbe2..f42b2d58 100644
--- a/Timeline/ClientApp/src/app/data/user.ts
+++ b/Timeline/ClientApp/src/app/data/user.ts
@@ -363,6 +363,15 @@ export class UserInfoService {
await getHttpUserClient().putAvatar(username, blob, user.token);
this._avatarHub.getLine(username)?.next({ data: blob, type: "synced" });
}
+
+ async setNickname(username: string, nickname: string): Promise<void> {
+ const user = checkLogin();
+ return getHttpUserClient()
+ .patch(username, { nickname }, user.token)
+ .then((user) => {
+ void this.saveUser(user);
+ });
+ }
}
export const userInfoService = new UserInfoService();