From 1eec6338e1146439b1dbc6207843fbc44dd13088 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 30 Oct 2024 18:01:48 -0400 Subject: Don't leave field binding vars uninitialized. This was causing problems for changing passwords: if the user didn't type anything in the "original password" field, the code path to sending that field to the server was just straight-up omitting the field from the message, rather than setting it to empty string, causing a 422 Unprocessable Entity. On investigation we had latent bugs related to this in a bunch of spots. --- ui/lib/apiServer.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'ui/lib/apiServer.js') diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index 19dcf60..5c6e5ef 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -10,20 +10,12 @@ 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 setup(name, password) { + return apiServer.post('/setup', { name, password }); } -export async function logIn(username, password) { - const data = { - name: username, - password, - }; - return apiServer.post('/auth/login', data); +export async function logIn(name, password) { + return apiServer.post('/auth/login', { name, password }); } export async function logOut() { @@ -46,7 +38,7 @@ export async function deleteMessage(messageId) { // TODO } -export async function createInvite(inviteId) { +export async function createInvite() { return apiServer.post(`/invite`, {}); } -- cgit v1.2.3