Skip to content

Commit

Permalink
fix: registration data loading
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mi committed Mar 19, 2024
1 parent ce47426 commit 22880b9
Show file tree
Hide file tree
Showing 38 changed files with 1,177 additions and 2,144 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@
"dev": "node scripts/start.js",
"dev:server": "nodemon",
"build": "node scripts/build.js",
"test": "cross-env FAST_REFRESH=false BROWSER=none REACT_APP_API_URL=http://127.0.0.1:9001 HTTPS=0 PORT=9001 WDS_SOCKET_PORT=9001 concurrently --kill-others --success first \"npm run dev\" \"wait-on http://127.0.0.1:9001 && cypress run\"",
"test": "cross-env NODE_ENV=development FAST_REFRESH=false BROWSER=none REACT_APP_API_URL=http://127.0.0.1:9001 HTTPS=0 PORT=9001 WDS_SOCKET_PORT=9001 concurrently --kill-others --success first \"npm run dev\" \"wait-on http://127.0.0.1:9001 && cypress run\"",
"test:components": "NODE_ENV=development cypress run --component --headed",
"test:build": "cross-env FAST_REFRESH=false BROWSER=none PORT=9001 CYPRESS_WS_URL=http://127.0.0.1:9002 REACT_APP_API_URL=http://127.0.0.1:9001 concurrently --kill-others --success first \"npm run start\" \"wait-on http://127.0.0.1:9001 && cypress run\"",
"test:build": "cross-env NODE_ENV=production FAST_REFRESH=false BROWSER=none PORT=9001 CYPRESS_WS_URL=http://127.0.0.1:9002 REACT_APP_API_URL=http://127.0.0.1:9001 concurrently --kill-others --success first \"npm run start\" \"wait-on http://127.0.0.1:9001 && cypress run\"",
"release": "standard-version",
"lint": "npm run lint:scripts && npm run lint:style",
"lint:scripts": "eslint src && tsc",
Expand Down
2 changes: 1 addition & 1 deletion src/api/apiAgencySelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const apiAgencySelection = async (
...params
}: {
postcode?: string;
consultingType?: number | undefined;
consultingType?: number;
topicId?: number;
age?: number;
gender?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/api/apiGetTopicGroups.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TopicGroup } from '../globalState/interfaces/TopicGroups';
import { TopicGroup } from '../globalState/interfaces';
import { endpoints } from '../resources/scripts/endpoints';
import { fetchData, FETCH_ERRORS, FETCH_METHODS } from './fetchData';

Expand All @@ -7,7 +7,7 @@ export const apiGetTopicGroups = async (): Promise<{
}> => {
return fetchData({
url: endpoints.topicGroups,
responseHandling: [FETCH_ERRORS.EMPTY],
responseHandling: [FETCH_ERRORS.EMPTY, FETCH_ERRORS.NO_MATCH],
method: FETCH_METHODS.GET
});
};
49 changes: 23 additions & 26 deletions src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ export const Input = ({
}}
sx={{
'&[type=number]': {
'-moz-appearance': 'textfield'
MozAppearance: 'textfield'
},
'&::-webkit-outer-spin-button': {
'-webkit-appearance': 'none',
'margin': 0
WebkitAppearance: 'none',
margin: 0
},
'&::-webkit-inner-spin-button': {
'-webkit-appearance': 'none',
'margin': 0
WebkitAppearance: 'none',
margin: 0
},
'mt': '24px',
'& legend': {
Expand Down Expand Up @@ -205,7 +205,7 @@ export const Input = ({
setShrink(true);
}}
onBlur={handleBlur}
></TextField>
/>
{info && !inputError && !showSuccessMessage && (
<Typography
variant="body2"
Expand Down Expand Up @@ -245,26 +245,23 @@ export const Input = ({
{successMesssage}
</Typography>
)}
{multipleCriteria &&
multipleCriteria.map((criteria) => {
return (
<Typography
variant="body2"
sx={{
mt: '8px',
fontSize: '16px',
lineHeight: '16px',
color: getMultipleCriteriaDesign(criteria)
.color,
display: 'flex',
alignItems: 'center'
}}
>
{getMultipleCriteriaDesign(criteria).icon}{' '}
{t(criteria.info)}
</Typography>
);
})}
{multipleCriteria?.map((criteria) => (
<Typography
key={criteria.info}
variant="body2"
sx={{
mt: '8px',
fontSize: '16px',
lineHeight: '16px',
color: getMultipleCriteriaDesign(criteria).color,
display: 'flex',
alignItems: 'center'
}}
>
{getMultipleCriteriaDesign(criteria).icon}{' '}
{t(criteria.info)}
</Typography>
))}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { UrlParamsContext } from '../../../globalState/provider/UrlParamsProvide
import { VALID_POSTCODE_LENGTH } from '../../../components/agencySelection/agencySelectionHelpers';

interface AgenciesForRegistrationArgs {
consultingType: ConsultingTypeInterface;
consultingType?: ConsultingTypeInterface;
postcode: string;
topic: TopicsDataInterface;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ export const useAgenciesForRegistration = ({

const allAgencies = useMemo(() => {
// As long as no consulting type or topic is selected we can't show any agencies
if (!consultingType || topicsEnabledAndUnSelected) {
if (!consultingType && topicsEnabledAndUnSelected) {
return [];
}

Expand Down Expand Up @@ -131,8 +131,9 @@ export const useAgenciesForRegistration = ({
apiAgencySelection(
{
...(autoSelectPostcode ? {} : { postcode }),
consultingType: consultingType?.id,
topicId: topic?.id,
// API will ignore consultingType if topicId isset but its required to be send
consultingType: topic?.id || consultingType?.id,
fetchConsultingTypeDetails: true
},
abortController.signal
Expand Down
51 changes: 0 additions & 51 deletions src/extensions/components/app/app.tsx

This file was deleted.

This file was deleted.

Loading

0 comments on commit 22880b9

Please sign in to comment.