Skip to content

Commit

Permalink
Updated update roles mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
autsada committed Aug 23, 2020
1 parent 9713a4d commit 3b37b94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/resolvers/AuthResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ export class AuthResolvers {
if (!user) throw new Error('User not found.')

// Update roles
user.roles = newRoles
if (!newRoles.includes(RoleOptions.client)) {
user.roles = [...newRoles, RoleOptions.client]
} else {
user.roles = newRoles
}

await user.save()

Expand Down

0 comments on commit 3b37b94

Please sign in to comment.