From 5ff106e910544788bc916626ae7665cb26e5af30 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 11 Oct 2024 20:55:36 -0400 Subject: Provide a separate "initial setup" endpoint that creates a user. --- ui/lib/apiServer.js | 9 +++++++++ ui/lib/components/LogIn.svelte | 27 ++++++--------------------- 2 files changed, 15 insertions(+), 21 deletions(-) (limited to 'ui/lib') diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index ccd6e66..46fcb53 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -3,12 +3,21 @@ import { channelsList, logins, messages } from '$lib/store'; export const apiServer = axios.create({ baseURL: '/api/', + validateStatus: (status) => status >= 200 && status < 500, }); export async function boot() { return apiServer.get('/boot'); } +export async function setup(username, password) { + const data = { + name: username, + password, + }; + return apiServer.post('/setup', data); +} + export async function logIn(username, password) { const data = { name: username, diff --git a/ui/lib/components/LogIn.svelte b/ui/lib/components/LogIn.svelte index e1cda8a..bb80ccd 100644 --- a/ui/lib/components/LogIn.svelte +++ b/ui/lib/components/LogIn.svelte @@ -1,27 +1,12 @@
-
+
-- cgit v1.2.3