Skip to content

Commit

Permalink
Merge pull request #49 from vtex-apps/feature/message-duplicated-impr…
Browse files Browse the repository at this point in the history
…ovement

[B2BORG-115] In this scenario - When trying to add the same user in two different organizations (Getting invalid popup) [PFA]
  • Loading branch information
arturmagalhaesjr authored Jun 22, 2022
2 parents 253c464 + 3b4717b commit d734d89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Add error messages improvement

## [1.21.0] - 2022-06-17

### Added
Expand Down
8 changes: 7 additions & 1 deletion node/resolvers/Mutations/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,14 @@ export const addUser = async (_: any, params: any, ctx: Context) => {
const userExists = await getUser({ masterdata, params })

if (userExists) {
if (userExists.orgId === params.orgId) {
throw new Error(
`User with email ${params.email} already exists in the organization, id="${userExists.id}"`
)
}

throw new Error(
`User with email ${params.email} already exists, id="${userExists.id}"`
`User with email ${params.email} already exists in another organization, id="${userExists.id}"`
)
}

Expand Down

0 comments on commit d734d89

Please sign in to comment.