diff --git a/frontend/src/routes/stepper/index.tsx b/frontend/src/routes/stepper/index.tsx index 99932891c5ca21171d9d30452abe2dd2ae2df431..e3cb7c1d83906bc635c0e46bbf2b0ce24d7703c2 100644 --- a/frontend/src/routes/stepper/index.tsx +++ b/frontend/src/routes/stepper/index.tsx @@ -12,7 +12,6 @@ import StepPersonForm from './stepPersonForm' import { PersonFormMethods } from './personFormMethods' import { SummaryFormMethods } from './summaryFormMethods' -import { fetchRoletypes } from '../../utils/apiCalls' import { RolesContext } from '../../context' const steps = ['Register', 'Summary'] @@ -36,6 +35,17 @@ export default function StepRegistration() { const REGISTER_STEP = 0 const SUMMARY_STEP = 1 + async function fetchRoletypes(onSuccess: (result: Array<any>) => void, onError: (error: any) => void) { + fetch(`http://localhost:3000/api/ui/v1/roletypes/`) + .then(data => data.text()) + .then((result => { + // The response is a JSON-array + onSuccess(JSON.parse(result)) + })) + .catch(error => { + onError(error) + }) + } useEffect(() => { fetchRoletypes( @@ -87,6 +97,7 @@ export default function StepRegistration() { {/* Stepper at top of wizard */} <Stepper activeStep={activeStep}> + {/* eslint-disable-next-line @typescript-eslint/no-unused-vars */} {steps.map((label, index) => { const stepProps = {} const labelProps = {} diff --git a/frontend/src/utils/apiCalls.ts b/frontend/src/utils/apiCalls.ts deleted file mode 100644 index e375feeb301df4ad3baeb3d05def1c15591503b4..0000000000000000000000000000000000000000 --- a/frontend/src/utils/apiCalls.ts +++ /dev/null @@ -1,11 +0,0 @@ -export async function fetchRoletypes(onSuccess: (result: Array<any>) => void, onError: (error: any) => void) { - fetch(`http://localhost:3000/api/ui/v1/roletypes/`) - .then(data => data.text()) - .then((result => { - // The response is a JSON-array - onSuccess(JSON.parse(result)) - })) - .catch(error => { - onError(error) - }) -}