aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/data/user.ts
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
commitc620d1d66757567f6b0f7abc66bc0f4c02be7ad3 (patch)
tree82a6b9acafdcad685fa306674cc934bd21d11280 /Timeline/ClientApp/src/app/data/user.ts
parent738a17688ca481db62755295f8b732200ca12511 (diff)
parent201f75e0c339d3745a1fdb43a9579d502c447710 (diff)
downloadtimeline-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/data/user.ts')
-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();