From b7569ce77a050ffe2abe0a98d2a4f858ca6d17a0 Mon Sep 17 00:00:00 2001 From: Sleeyax Date: Sat, 6 Sep 2025 15:14:29 +0200 Subject: [PATCH] refactor: swap HTTP methods for user creation and update endpoints (closes #351) (#354) --- packages/frontend/src/services/api.ts | 4 ++-- packages/server/src/routes/api/user.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/services/api.ts b/packages/frontend/src/services/api.ts index 250e456e..e0bb5419 100644 --- a/packages/frontend/src/services/api.ts +++ b/packages/frontend/src/services/api.ts @@ -75,7 +75,7 @@ export class UserConfigAPI { ): Promise> { try { const response = await fetch(`${this.BASE_URL}/user`, { - method: 'PUT', + method: 'POST', headers: { 'Content-Type': 'application/json', }, @@ -125,7 +125,7 @@ export class UserConfigAPI { ): Promise> { try { const response = await fetch(`${this.BASE_URL}/user`, { - method: 'POST', + method: 'PUT', headers: { 'Content-Type': 'application/json', }, diff --git a/packages/server/src/routes/api/user.ts b/packages/server/src/routes/api/user.ts index 26e021e1..06604fb2 100644 --- a/packages/server/src/routes/api/user.ts +++ b/packages/server/src/routes/api/user.ts @@ -105,7 +105,7 @@ router.get('/', async (req, res, next) => { }); // new user creation -router.put('/', async (req, res, next) => { +router.post('/', async (req, res, next) => { const { config, password } = req.body; if (!config || !password) { next( @@ -143,7 +143,7 @@ router.put('/', async (req, res, next) => { }); // updating user details -router.post('/', async (req, res, next) => { +router.put('/', async (req, res, next) => { const { uuid, password, config } = req.body; if (!uuid || !password || !config) { next(