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 6005617
Show file tree
Hide file tree
Showing 26 changed files with 996 additions and 1,140 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
});
};
11 changes: 6 additions & 5 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 @@ -249,6 +249,7 @@ export const Input = ({
multipleCriteria.map((criteria) => {
return (
<Typography
key={criteria.info}
variant="body2"
sx={{
mt: '8px',
Expand Down
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,
// ToDo: API will ignore consultingType if topicId isset but its required to be send
consultingType: topic?.id || consultingType?.id,
fetchConsultingTypeDetails: true
},
abortController.signal
Expand Down
7 changes: 2 additions & 5 deletions src/extensions/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ export const App = (props: AppProps) => {
{
route: {
path: [
'/registration',
'/registration/topic-selection',
'/registration/zipcode',
'/registration/account-data',
'/registration/agency-selection'
'/registration/:step?',
'/:topicSlug/registration/:step?'
]
},
component: NewRegistration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const ConsultingTypesGroupChildDetails = ({
.map((part, index) => (
<Text
className="consultingTypesGroupChildDetails__explanationDescriptionPart"
key={index}
key={part}
type="infoLargeStandard"
text={part}
/>
Expand Down
Loading

0 comments on commit 6005617

Please sign in to comment.