aboutsummaryrefslogtreecommitdiffstats
path: root/src/wwwroot/scripts/api/account-api.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/wwwroot/scripts/api/account-api.ts')
-rw-r--r--src/wwwroot/scripts/api/account-api.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/wwwroot/scripts/api/account-api.ts b/src/wwwroot/scripts/api/account-api.ts
new file mode 100644
index 0000000..0d8604b
--- /dev/null
+++ b/src/wwwroot/scripts/api/account-api.ts
@@ -0,0 +1,28 @@
+import {LoginPayload} from "./account-api.types"
+
+export function login(payload: LoginPayload, xsrf: string): Promise<Response> {
+ return fetch("/api/account/login", {
+ method: "post",
+ body: JSON.stringify(payload),
+ headers: {
+ "Content-Type": "application/json;charset=utf-8",
+ "XSRF-TOKEN": xsrf
+ }
+ });
+}
+
+export function logout(): Promise<Response> {
+ return fetch("/api/account/logout");
+}
+
+export function updatePassword(newPassword: string): Promise<Response> {
+ return fetch("/api/account/update-password", {
+ method: "post",
+ body: JSON.stringify({
+ newPassword
+ }),
+ headers: {
+ "Content-Type": "application/json;charset=utf-8"
+ }
+ });
+} \ No newline at end of file