From 9383a2fb09ffb60cfe63683106945bd688affa59 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 1 Jun 2022 21:13:43 +0200 Subject: feat: Initial commit after clean slate --- src/wwwroot/scripts/api/account-api.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/wwwroot/scripts/api/account-api.ts (limited to 'src/wwwroot/scripts/api/account-api.ts') 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 { + 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 { + return fetch("/api/account/logout"); +} + +export function updatePassword(newPassword: string): Promise { + 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 -- cgit v1.3