aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-30 17:45:24 +0800
committercrupest <crupest@outlook.com>2022-04-30 17:45:24 +0800
commitfff1a785aad30ebc9e96bbf973c7916143193b36 (patch)
tree0dfc317c644d611a5045628d29ffe57a7a176b1c /FrontEnd
parent13026c4f3b36bd8490c36e6cdc8d114e93c7e135 (diff)
downloadtimeline-fff1a785aad30ebc9e96bbf973c7916143193b36.tar.gz
timeline-fff1a785aad30ebc9e96bbf973c7916143193b36.tar.bz2
timeline-fff1a785aad30ebc9e96bbf973c7916143193b36.zip
...
Diffstat (limited to 'FrontEnd')
-rw-r--r--FrontEnd/src/http/user.ts19
1 files changed, 19 insertions, 0 deletions
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<HttpUser[]>;
get(username: string): Promise<HttpUser>;
@@ -62,6 +66,9 @@ export interface IHttpUserClient {
username: string,
req: HttpBookmarkVisibility
): Promise<void>;
+
+ getRegisterCode(username: string): Promise<HttpRegisterCode>;
+ renewRegisterCode(username: string): Promise<void>;
}
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<HttpRegisterCode> {
+ return axios
+ .get<HttpRegisterCode>(`${apiBaseUrl}/v2/users/${username}/registercode`)
+ .then(extractResponseData);
+ }
+
+ renewRegisterCode(username: string): Promise<void> {
+ return axios
+ .post(`${apiBaseUrl}/v2/users/${username}/renewregistercode`)
+ .then();
+ }
}
let client: IHttpUserClient = new HttpUserClient();