Skip to content

Commit

Permalink
fix: update the roles state when user navigate between the steps (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamv-ss authored Jul 12, 2024
1 parent 6f1f8c6 commit 2ebd087
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/components/cax-companyRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ export const CompanyRoleCax = () => {

const { data: allConsentData, error: allConsentError } =
useFetchAgreementDataQuery()
const { data: consentData, error: consentError } =
useFetchAgreementConsentsQuery(applicationId)
const {
data: consentData,
error: consentError,
refetch,
} = useFetchAgreementConsentsQuery(applicationId)
const [updateAgreementConsents] = useUpdateAgreementConsentsMutation()

useEffect(() => {
refetch()
}, [companyRoleChecked])

useEffect(() => {
updateSelectedRolesAndAgreement()
}, [consentData])
Expand Down
15 changes: 11 additions & 4 deletions src/components/verifyRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useTranslation } from 'react-i18next'
import { FooterButton } from './footerButton'
import { useDispatch, useSelector } from 'react-redux'
import { useHistory } from 'react-router-dom'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { useFetchApplicationsQuery } from '../state/features/application/applicationApiSlice'
import { useFetchDocumentsQuery } from '../state/features/applicationDocuments/applicationDocumentsApiSlice'
import {
Expand Down Expand Up @@ -52,12 +52,19 @@ export const VerifyRegistration = () => {
const obj = status?.[status.length - 1]
const applicationId = obj?.applicationId

const { data: registrationData, error: dataError } =
useFetchRegistrationDataQuery(applicationId)
const {
data: registrationData,
error: dataError,
refetch,
} = useFetchRegistrationDataQuery(applicationId)
const { data: documents, error: documentsError } =
useFetchDocumentsQuery(applicationId)
const [updateRegistration] = useUpdateRegistrationMutation()


useEffect(() => {
refetch()
}, [])

const backClick = () => {
dispatch(addCurrentStep(currentActiveStep - 1))
}
Expand Down

0 comments on commit 2ebd087

Please sign in to comment.