Skip to content

Commit

Permalink
Bug/998 admin module login disapeared (#1003)
Browse files Browse the repository at this point in the history
- Validating the Role.Admin and Role.Facilitator from the users cached token, instead of currentUser, since Fusion didn't return this anymore.
  • Loading branch information
ManveerPandher authored Mar 23, 2022
1 parent c8225c1 commit 31f24eb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { EVALUATION_FIELDS_FRAGMENT } from '../../../../api/fragments'
import CreateEvaluationDialog from './CreateEvaluationDialog'
import { useEffectNotOnMount } from '../../../../utils/hooks'
import { useCurrentUser } from '@equinor/fusion'
import { getCachedRoles } from "../../../../utils/helpers"

interface CreateEvaluationButtonProps {
projectId: string
Expand All @@ -20,7 +21,7 @@ const CreateEvaluationButton = ({ projectId }: CreateEvaluationButtonProps) => {
const project = useProject()
const [showDialog, setShowDialog] = useState<boolean>(false)
const { createEvaluation, loading: creatingEvaluation, evaluation, error: createEvaluationError } = useCreateEvaluationMutation()
const canCreateEvaluation = currentUser && currentUser.roles.includes('Role.Facilitator')
const canCreateEvaluation = currentUser && getCachedRoles().includes('Role.Facilitator')

useEffectNotOnMount(() => {
if (!creatingEvaluation && evaluation !== undefined) {
Expand Down

0 comments on commit 31f24eb

Please sign in to comment.