aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-07 03:54:20 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-07 03:54:20 +0100
commit914c75e0ceeb3e11ddd55e94bb461c26b0db5b7a (patch)
treecec5c933b3beb64d4808cdc6bd8fcd8e4dc55421 /code/app/src/lib
parent1a3c7bab2ad7deae0a778eb84b6d130df1bd9d36 (diff)
downloadgreatoffice-914c75e0ceeb3e11ddd55e94bb461c26b0db5b7a.tar.xz
greatoffice-914c75e0ceeb3e11ddd55e94bb461c26b0db5b7a.zip
feat:Small changes
Diffstat (limited to 'code/app/src/lib')
-rw-r--r--code/app/src/lib/api/projects/index.ts12
-rw-r--r--code/app/src/lib/components/textarea.svelte2
-rw-r--r--code/app/src/lib/configuration.ts2
-rw-r--r--code/app/src/lib/session.ts2
4 files changed, 15 insertions, 3 deletions
diff --git a/code/app/src/lib/api/projects/index.ts b/code/app/src/lib/api/projects/index.ts
new file mode 100644
index 0000000..ea49631
--- /dev/null
+++ b/code/app/src/lib/api/projects/index.ts
@@ -0,0 +1,12 @@
+import { api_base } from "$lib/configuration";
+import { http_post_async } from "../_fetch";
+
+export const http_projects = {
+ create_async(payload: CreateProjectPayload): Promise<Response> {
+ return http_post_async(api_base("projects/create", true), payload);
+ }
+};
+
+export type CreateProjectPayload = {
+ name: ""
+} \ No newline at end of file
diff --git a/code/app/src/lib/components/textarea.svelte b/code/app/src/lib/components/textarea.svelte
index 0f2c665..a3dd06a 100644
--- a/code/app/src/lib/components/textarea.svelte
+++ b/code/app/src/lib/components/textarea.svelte
@@ -23,7 +23,7 @@
id: id || null,
disabled: disabled || null,
required: required || null,
- };
+ } as any;
let textareaElement;
let scrollHeight = 0;
diff --git a/code/app/src/lib/configuration.ts b/code/app/src/lib/configuration.ts
index 541be35..8debef6 100644
--- a/code/app/src/lib/configuration.ts
+++ b/code/app/src/lib/configuration.ts
@@ -4,7 +4,7 @@ export const API_ADDRESS = "https://api." + BASE_DOMAIN;
export const DEV_API_ADDRESS = "http://localhost:5000";
export const SECONDS_BETWEEN_SESSION_CHECK = 600;
-export function api_base(path: string = ""): string {
+export function api_base(path: string = "", useDefaultVersion = false): string {
return (is_development() ? DEV_API_ADDRESS : API_ADDRESS) + (path !== "" ? "/" + path : "");
}
diff --git a/code/app/src/lib/session.ts b/code/app/src/lib/session.ts
index 317bf59..5c29cd6 100644
--- a/code/app/src/lib/session.ts
+++ b/code/app/src/lib/session.ts
@@ -25,7 +25,7 @@ export async function is_active(forceRefresh: boolean = false): Promise<boolean>
export async function end_session(cb: Function): Promise<void> {
await http_account.logout_async();
clear_session_data();
- cb();
+ if (typeof cb === "function") cb();
}
async function call_api(): Promise<boolean> {