mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
🛂 fix: Normalize Verification Flow Error Responses (#13558)
* fix: normalize verification flow responses * fix: keep verification responses consistent
This commit is contained in:
parent
75bbefb1c8
commit
8c71dbcb32
4 changed files with 184 additions and 14 deletions
|
|
@ -388,7 +388,7 @@ const verifyEmailController = async (req, res) => {
|
|||
try {
|
||||
const verifyEmailService = await verifyEmail(req);
|
||||
if (verifyEmailService instanceof Error) {
|
||||
return res.status(400).json(verifyEmailService);
|
||||
return res.status(400).json({ message: verifyEmailService.message });
|
||||
} else {
|
||||
return res.status(200).json(verifyEmailService);
|
||||
}
|
||||
|
|
@ -402,9 +402,9 @@ const resendVerificationController = async (req, res) => {
|
|||
try {
|
||||
const result = await resendVerificationEmail(req);
|
||||
if (result instanceof Error) {
|
||||
return res.status(400).json(result);
|
||||
return res.status(400).json({ message: result.message });
|
||||
} else {
|
||||
return res.status(200).json(result);
|
||||
return res.status(result.status ?? 200).json({ message: result.message });
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error('[verifyEmailController]', e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue