Skip to content

Commit

Permalink
fix(defaults): revert defaults set to empty string (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyo authored Apr 17, 2024
1 parent dc4fcce commit e73542f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
25 changes: 12 additions & 13 deletions src/components/cax-companyData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const CompanyDataCax = () => {
const { data: status } = useFetchApplicationsQuery()

const obj = status?.[status.length - 1] //.find(o => o['applicationStatus'] === CREATED);
const applicationId = obj?.applicationId ?? ''
const applicationId = obj?.applicationId

const [bpn, setBpn] = useState('')
const [bpnErrorMsg, setBpnErrorMessage] = useState('')
Expand Down Expand Up @@ -156,14 +156,14 @@ export const CompanyDataCax = () => {
}, [identifierType, identifierNumber, country])

useEffect(() => {
setBpn(companyDetails?.bpn ?? '')
setLegalEntity(companyDetails?.name ?? '')
setRegisteredName(companyDetails?.name ?? '')
setStreetHouseNumber(companyDetails?.streetName ?? '')
setRegion(companyDetails?.region ?? '')
setPostalCode(companyDetails?.zipCode ?? '')
setCity(companyDetails?.city ?? '')
setCountry(companyDetails?.countryAlpha2Code ?? '')
setBpn(companyDetails?.bpn)
setLegalEntity(companyDetails?.name)
setRegisteredName(companyDetails?.name)
setStreetHouseNumber(companyDetails?.streetName)
setRegion(companyDetails?.region)
setPostalCode(companyDetails?.zipCode)
setCity(companyDetails?.city)
setCountry(companyDetails?.countryAlpha2Code)
setUniqueIds(companyDetails?.uniqueIds)
setIdentifierNumber(companyDetails?.uniqueIds?.[0]?.value)
setIdentifierType(companyDetails?.uniqueIds?.[0]?.type)
Expand Down Expand Up @@ -377,8 +377,8 @@ export const CompanyDataCax = () => {
companyData.countryAlpha2Code = country
companyData.uniqueIds = [
{
type: identifierType ?? '',
value: identifierNumber ?? '',
type: identifierType,
value: identifierNumber,
},
]
//addCompanyData(companyData)
Expand Down Expand Up @@ -568,12 +568,11 @@ export const CompanyDataCax = () => {
<Autocomplete
id="selectList"
options={countryArr}
defaultValue={defaultSelectedCountry ?? ''}
defaultValue={defaultSelectedCountry}
renderInput={(params) => (
<TextField variant="standard" {...params} />
)}
onChange={(_e, values) => {
// @ts-expect-error keep for compatibility
validateCountry(values?.id)
}}
sx={{
Expand Down
8 changes: 4 additions & 4 deletions src/components/cax-companyRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const CompanyRoleCax = () => {
const { data: allConsentData, error: allConsentError } =
useFetchAgreementDataQuery()
const { data: consentData, error: consentError } =
useFetchAgreementConsentsQuery(applicationId ?? '')
useFetchAgreementConsentsQuery(applicationId)
const [updateAgreementConsents] = useUpdateAgreementConsentsMutation()

useEffect(() => {
Expand Down Expand Up @@ -95,7 +95,7 @@ export const CompanyRoleCax = () => {
)

const updatedAgreementIds = allConsentData?.companyRoles[
companyRoleIndex ?? ''
companyRoleIndex
].agreementIds.reduce((prev, next) => {
return { ...prev, [next]: false }
}, {})
Expand Down Expand Up @@ -127,7 +127,7 @@ export const CompanyRoleCax = () => {
.then(async (res) => {
const fileType = res.headers.get('content-type')
const file = await res.blob()
download(file, fileType ?? '', documentName)
download(file, fileType, documentName)
})
.catch((error) => {
console.log(error)
Expand Down Expand Up @@ -215,7 +215,7 @@ export const CompanyRoleCax = () => {
agreements,
}

await updateAgreementConsents({ applicationId: applicationId ?? '', data })
await updateAgreementConsents({ applicationId, data })
.unwrap()
.then(() => {
dispatch(addCurrentStep(currentActiveStep + 1))
Expand Down
8 changes: 4 additions & 4 deletions src/components/cax-responsibilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const ResponsibilitiesCax = () => {
const { data: status } = useFetchApplicationsQuery()

const obj = status?.[status.length - 1] //.find(o => o['applicationStatus'] === CREATED);
const applicationId = obj?.applicationId ?? ''
const applicationId = obj?.applicationId

const [updateInviteNewUser] = useUpdateInviteNewUserMutation()
const { data: rolesComposite, error: rolesError } =
Expand Down Expand Up @@ -201,7 +201,7 @@ export const ResponsibilitiesCax = () => {
<input
type="text"
name="email"
value={email ?? ''}
value={email}
onChange={(e) => validateEmailOnChange(e.target.value)}
/>
<AiOutlineExclamationCircle className="error-icon" />
Expand All @@ -212,7 +212,7 @@ export const ResponsibilitiesCax = () => {
<Row className="mx-auto col-9">
<div className="form-data">
<label>{t('Responsibility.role')}</label>
<select value={role ?? ''} onChange={(e) => onRoleChange(e)}>
<select value={role} onChange={(e) => onRoleChange(e)}>
{availableUserRoles &&
availableUserRoles.map((role, index) => (
<option key={index} value={role}>
Expand All @@ -228,7 +228,7 @@ export const ResponsibilitiesCax = () => {
<label>{t('Responsibility.note')}</label>
<textarea
name="message"
value={message ?? ''}
value={message}
onChange={(e) => validatePersonalNoteOnChange(e.target.value)}
/>
<div className="error-message">{appError.personalNote}</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/dragdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const DragDrop = () => {

const { data: status } = useFetchApplicationsQuery()
const obj = status?.[status.length - 1]
const applicationId = obj?.applicationId ?? ''
const applicationId = obj?.applicationId

const [fileError, setFileError] = useState('')
const [deleteDocResponse, setDeleteDocResponse] = useState({
Expand Down Expand Up @@ -231,7 +231,7 @@ export const DragDrop = () => {
{document.documentName}
</div>
<div className="dropzone-overview-file-status">
{`${getStatusText(document.status ?? '')} ${
{`${getStatusText(document.status)} ${
document.progress && document?.progress !== 100
? document?.progress
: ''
Expand All @@ -241,7 +241,7 @@ export const DragDrop = () => {
<div
role="progressbar"
className={`progress-bar bg-${getClassNameByStatus(
document.status ?? ''
document.status
)}`}
style={{
width: `${document?.progress}%`,
Expand Down
2 changes: 1 addition & 1 deletion src/components/footerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const FooterButton = ({
}
handleClick={handleNextClick}
showTooltip={tooltip ? true : false}
tooltipText={tooltip ?? ''}
tooltipText={tooltip}
disabled={disabled}
loading={loading}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/footerHeadline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const FooterHeadline = ({ helpUrl }: { helpUrl?: string }) => {
<a
href={window.location.pathname.replace(
window.location.pathname,
helpUrl ?? ''
helpUrl
)}
target="_blank"
rel="noreferrer"
Expand Down
4 changes: 2 additions & 2 deletions src/components/verifyRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const VerifyRegistration = () => {
const { data: status } = useFetchApplicationsQuery()

const obj = status?.[status.length - 1]
const applicationId = obj?.applicationId ?? ''
const applicationId = obj?.applicationId

const { data: registrationData, error: dataError } =
useFetchRegistrationDataQuery(applicationId)
Expand Down Expand Up @@ -87,7 +87,7 @@ export const VerifyRegistration = () => {
return null
}

const hasRoles = () => (registrationData?.companyRoles.length ?? 0) > 0
const hasRoles = () => registrationData?.companyRoles.length > 0

const hasDocuments = () => documents && documents.length > 0

Expand Down

0 comments on commit e73542f

Please sign in to comment.