diff options
Diffstat (limited to 'code/app/src/lib')
| -rw-r--r-- | code/app/src/lib/api/projects/index.ts | 12 | ||||
| -rw-r--r-- | code/app/src/lib/components/textarea.svelte | 2 | ||||
| -rw-r--r-- | code/app/src/lib/configuration.ts | 2 | ||||
| -rw-r--r-- | code/app/src/lib/session.ts | 2 |
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> { |
