aboutsummaryrefslogtreecommitdiffstats
path: root/apps/kit/src/lib/api/user.ts
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-10-05 14:45:21 +0200
committerivarlovlie <git@ivarlovlie.no>2022-10-05 14:45:21 +0200
commitb7e39b59fd0fc7b5610ebff29035bf622079e0d8 (patch)
tree64be84ebbdac9f7ceced983390c53b10d575af5c /apps/kit/src/lib/api/user.ts
parent2001c035fbb417ab0a3d42cfb04d17420bde4086 (diff)
downloadgreatoffice-b7e39b59fd0fc7b5610ebff29035bf622079e0d8.tar.xz
greatoffice-b7e39b59fd0fc7b5610ebff29035bf622079e0d8.zip
refactor: Change file structure
Diffstat (limited to 'apps/kit/src/lib/api/user.ts')
-rw-r--r--apps/kit/src/lib/api/user.ts47
1 files changed, 0 insertions, 47 deletions
diff --git a/apps/kit/src/lib/api/user.ts b/apps/kit/src/lib/api/user.ts
deleted file mode 100644
index f0dc932..0000000
--- a/apps/kit/src/lib/api/user.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import {api_base} from "$lib/configuration";
-import {http_delete, http_get, http_post} from "./internal-fetch";
-import type {LoginPayload} from "$lib/models/LoginPayload";
-import type {UpdateProfilePayload} from "$lib/models/UpdateProfilePayload";
-import type {CreateAccountPayload} from "$lib/models/CreateAccountPayload";
-import type {IInternalFetchResponse} from "$lib/models/IInternalFetchResponse";
-
-export async function login(payload: LoginPayload): Promise<IInternalFetchResponse> {
- return http_post(api_base("_/account/login"), payload);
-}
-
-export async function logout(): Promise<IInternalFetchResponse> {
- return http_get(api_base("_/account/logout"));
-}
-
-export async function create_forgot_password_request(username: string): Promise<IInternalFetchResponse> {
- if (!username) throw new Error("Username is empty");
- return http_get(api_base("_/forgot-password-requests/create?username=" + username));
-}
-
-export async function check_forgot_password_request(public_id: string): Promise<IInternalFetchResponse> {
- if (!public_id) throw new Error("Id is empty");
- return http_get(api_base("_/forgot-password-requests/is-valid?id=" + public_id));
-}
-
-export async function fulfill_forgot_password_request(public_id: string, newPassword: string): Promise<IInternalFetchResponse> {
- if (!public_id) throw new Error("Id is empty");
- return http_post(api_base("_/forgot-password-requests/fulfill"), {id: public_id, newPassword});
-}
-
-export async function delete_account(): Promise<IInternalFetchResponse> {
- return http_delete(api_base("_/account/delete"));
-}
-
-export async function update_profile(payload: UpdateProfilePayload): Promise<IInternalFetchResponse> {
- if (!payload.password && !payload.username) throw new Error("Password and Username is empty");
- return http_post(api_base("_/account/update"), payload);
-}
-
-export async function create_account(payload: CreateAccountPayload): Promise<IInternalFetchResponse> {
- if (!payload.password && !payload.username) throw new Error("Password and Username is empty");
- return http_post(api_base("_/account/create"), payload);
-}
-
-export async function get_profile_for_active_check(): Promise<IInternalFetchResponse> {
- return http_get(api_base("_/account"), 0, true);
-}