Skip to content

Commit

Permalink
Fix of introduced bug where the button would be unavailable if only g…
Browse files Browse the repository at this point in the history
…eneral was selected
  • Loading branch information
JurreBrandsenInfoSupport committed Apr 4, 2024
1 parent e875ae8 commit a580aeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/components/select-role.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ export default function SelectRoles({
<div className="flex">
<Button
onClick={handleSetGeneralRole}
disabled={
setDefaultRoleIsLoading ||
setRoleIsLoading ||
selectedRoles.length === 0 ||
setRoleError !== null
}
disabled={setRoleIsLoading || setRoleError !== null}
className="flex items-center justify-center bg-custom-buttonPrimary text-custom-secondary hover:bg-custom-buttonHover dark:bg-custom-buttonPrimary dark:hover:bg-custom-buttonHover"
>
<span className="mr-2">Go to survey</span>
Expand Down
5 changes: 4 additions & 1 deletion src/server/api/routers/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const surveyRouter = createTRPCRouter({
id: input.userId,
},
include: {
roles: true, // Include the roles associated with the user
roles: true,
},
});

Expand All @@ -98,6 +98,9 @@ export const surveyRouter = createTRPCRouter({
// If the user doesn't have the default role, add it to their roles
const updatedRoles = [...user.roles, defaultRole];

console.log("Setting default role for user", user.id);
console.log("Updated roles", updatedRoles);

await ctx.db.user.update({
where: {
id: input.userId,
Expand Down

0 comments on commit a580aeb

Please sign in to comment.