From fff1a785aad30ebc9e96bbf973c7916143193b36 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 30 Apr 2022 17:45:24 +0800 Subject: ... --- FrontEnd/src/http/user.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'FrontEnd/src/http') diff --git a/FrontEnd/src/http/user.ts b/FrontEnd/src/http/user.ts index c62f852c..bc8ad980 100644 --- a/FrontEnd/src/http/user.ts +++ b/FrontEnd/src/http/user.ts @@ -39,6 +39,10 @@ export interface HttpBookmarkVisibility { visibility: "Private" | "Register" | "Public"; } +export interface HttpRegisterCode { + registerCode?: string; +} + export interface IHttpUserClient { list(): Promise; get(username: string): Promise; @@ -62,6 +66,9 @@ export interface IHttpUserClient { username: string, req: HttpBookmarkVisibility ): Promise; + + getRegisterCode(username: string): Promise; + renewRegisterCode(username: string): Promise; } export class HttpUserClient implements IHttpUserClient { @@ -146,6 +153,18 @@ export class HttpUserClient implements IHttpUserClient { .put(`${apiBaseUrl}/v2/users/${username}/bookmarks/visibility`, req) .then(); } + + getRegisterCode(username: string): Promise { + return axios + .get(`${apiBaseUrl}/v2/users/${username}/registercode`) + .then(extractResponseData); + } + + renewRegisterCode(username: string): Promise { + return axios + .post(`${apiBaseUrl}/v2/users/${username}/renewregistercode`) + .then(); + } } let client: IHttpUserClient = new HttpUserClient(); -- cgit v1.2.3