fix(backend): fix registration with invite code (#8513)

* fix registration with invite code

* save one db call

* fix
This commit is contained in:
Ulf Gebhardt 2025-05-09 13:20:56 +02:00 committed by GitHub
parent ac79452ce6
commit 2278a9e311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,15 +88,18 @@ export default {
const [user] = createUserTransactionResponse.records.map((record) => record.get('user')) const [user] = createUserTransactionResponse.records.map((record) => record.get('user'))
if (!user) throw new UserInputError('Invalid email or nonce') if (!user) throw new UserInputError('Invalid email or nonce')
// To allow redeeming and return an User object we require a User in the context
context.user = user
// join Group via invite Code
await redeemInviteCode(context, inviteCode, true)
return user return user
}) })
try { try {
const user = await writeTxResultPromise const user = await writeTxResultPromise
// To allow redeeming and return an User object we require a User in the context
context.user = user
if (inviteCode) {
await redeemInviteCode(context, inviteCode, true)
}
return user return user
} catch (e) { } catch (e) {
if (e.code === 'Neo.ClientError.Schema.ConstraintValidationFailed') if (e.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')