fix: exists flag on /store/auth/:email endpoint (#1122)

This commit is contained in:
Michał
2022-03-02 10:18:11 +01:00
committed by GitHub
parent 4b4463f0e2
commit e844f4a5b7

View File

@@ -24,8 +24,10 @@ export default async (req, res) => {
try {
const customerService: CustomerService =
req.scope.resolve("customerService")
const customer = await customerService.retrieveByEmail(email)
res.status(200).json({ exists: !!customer.password_hash })
const customer = await customerService.retrieveByEmail(email, {
select: ["has_account"],
})
res.status(200).json({ exists: customer.has_account })
} catch (err) {
res.status(200).json({ exists: false })
}