From 0f7d8b1f0e1bc766587f6456d8c3b40d30d2ab84 Mon Sep 17 00:00:00 2001
From: Tore Brede <Tore.Brede@uib.no>
Date: Mon, 4 Oct 2021 08:42:57 +0200
Subject: [PATCH] GREG-60: Not using file with API calls

---
 frontend/src/routes/stepper/index.tsx | 13 ++++++++++++-
 frontend/src/utils/apiCalls.ts        | 11 -----------
 2 files changed, 12 insertions(+), 12 deletions(-)
 delete mode 100644 frontend/src/utils/apiCalls.ts

diff --git a/frontend/src/routes/stepper/index.tsx b/frontend/src/routes/stepper/index.tsx
index 99932891..e3cb7c1d 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 e375feeb..00000000
--- 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)
-    })
-}
-- 
GitLab