Skip to content

Commit

Permalink
error response
Browse files Browse the repository at this point in the history
  • Loading branch information
matmut7 committed Nov 15, 2023
1 parent 2aa195a commit efb2548
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/pages/api/accounts/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ const Enable = async (req: NextApiRequest, res: NextApiResponse) => {
response = { status: r.status, body: await r.json() }
} else if (serviceAccount.type == "ovh") {
if (!serviceAccount.users.email) {
res.status(400).json({
message:
"could not enable an ovh account for which we don't know the user's external email",
})
return
}
const r = await enableOvhAccount(
serviceAccount.data.primaryEmailAddress,
serviceAccount.users.email
)
response = {
status: r.success ? 200 : 500,
body: r.success ? (r.data as string) : JSON.stringify(r.error),
response = {
status: 400,
body: "could not enable an ovh account for which we don't know the user's external email",
}
} else {
const r = await enableOvhAccount(
serviceAccount.data.primaryEmailAddress,
serviceAccount.users.email
)
response = {
status: r.success ? 200 : 500,
body: r.success ? (r.data as string) : JSON.stringify(r.error),
}
}
} else {
logger.error(
Expand Down

0 comments on commit efb2548

Please sign in to comment.