Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ const EmailAttributesSelection = (): JSX.Element => {
attribute.selectedOption === '' ||
attribute.selectedOption === 'Select'
const isValueInvalid = attribute.value === null || attribute.value === ''
if (isOptionInvalid) {
setErrMsg('Condition is required')
return true
} else if (isValueInvalid) {
if (!isOptionInvalid && isValueInvalid) {
setErrMsg('Value is missing or is not a number')
return true
} else if (!isValueInvalid && isOptionInvalid) {
setErrMsg('Condition is missing')
return true
}
return false
}
Expand Down
15 changes: 10 additions & 5 deletions nextjs/src/features/verification/components/ProofRequestPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { JSX, useState } from 'react'
import { JSX, useEffect, useState } from 'react'

import { AlertComponent } from '@/components/AlertComponent'
import AttributesListData from './AttributesListData'
Expand All @@ -31,7 +31,7 @@ interface UserDataItem {
const ProofRequest = (props: IProofRrquestDetails): JSX.Element => {
const [buttonLoader, setButtonLoader] = useState(false)
const [navigation, setNavigation] = useState(false)
const [succesMsg, setSuccesMsg] = useState('')
const [successMsg, setSuccesMsg] = useState('')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typographical error: The success state setter function is named setSuccesMsg while the state variable is successMsg. Consider renaming it to setSuccessMsg for consistency.

const [error, setError] = useState('')
const orgId = useAppSelector((state) => state.organization.orgId)
const router = useRouter()
Expand Down Expand Up @@ -65,7 +65,12 @@ const ProofRequest = (props: IProofRrquestDetails): JSX.Element => {
(props?.userRoles ?? []).every((role) =>
[Roles.MEMBER, Roles.ISSUER].includes(role as Roles),
)

useEffect(() => {
if (props.openModal) {
setSuccesMsg('')
setNavigation(false)
}
}, [props.openModal])
return (
<Dialog
open={props.openModal}
Expand All @@ -81,9 +86,9 @@ const ProofRequest = (props: IProofRrquestDetails): JSX.Element => {
</DialogTitle>
</DialogHeader>

{!props.view && succesMsg && (
{!props.view && successMsg && (
<AlertComponent
message={succesMsg}
message={successMsg}
type="success"
onAlertClose={() => setSuccesMsg('')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const VerificationCredentialList = (): JSX.Element => {

const router = useRouter()
const orgId = useAppSelector((state) => state.organization.orgId)
const orgRoles = useAppSelector((state) => state.organization.orgRoles)
const orgRoles = useAppSelector((state) => state.organization.orgInfo)

const fetchOrganizationDetails = async (): Promise<void> => {
if (!orgId) {
Expand Down Expand Up @@ -243,7 +243,7 @@ const VerificationCredentialList = (): JSX.Element => {

useEffect(() => {
const getUserRoles = (): void => {
setUserRoles(orgRoles)
setUserRoles(orgRoles?.roles || [])
}
getUserRoles()
fetchOrganizationDetails()
Expand Down
10 changes: 10 additions & 0 deletions nextjs/src/features/verification/type/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Dispatch, JSX, SetStateAction } from 'react'

import { Roles } from '@/common/enums'

export interface RequestProof {
_tags: {
state: string
Expand Down Expand Up @@ -34,6 +36,14 @@ export interface IProofRrquestDetails {
view: boolean
userRoles?: string[]
}
export interface IUserRoles {
id: string
name: Roles
description: string
composite: boolean
clientRole: boolean
containerId: string
}

export interface IDashboard {
title: string
Expand Down
Loading