mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
bugfix: API new user return 400 if user creation failed (#1898)
* return 400 if user creation failed The client might not check the error field unless they realize it's a 4xx error instead of 200 success. * Update index.js * use one-liner style --------- Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
parent
5df6b5f7d9
commit
c4158b97d6
1 changed files with 1 additions and 1 deletions
|
@ -133,7 +133,7 @@ function apiAdminEndpoints(app) {
|
|||
|
||||
const newUserParams = reqBody(request);
|
||||
const { user: newUser, error } = await User.create(newUserParams);
|
||||
response.status(200).json({ user: newUser, error });
|
||||
response.status(newUser ? 200 : 400).json({ user: newUser, error });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
response.sendStatus(500).end();
|
||||
|
|
Loading…
Add table
Reference in a new issue