From c76ee24a78ac432328ee416ca700b392553b2d78 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 9 Jun 2023 17:59:29 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(API):=20replace=20axios?= =?UTF-8?q?=20with=20fetch=20for=20getVersion=20and=20getHealth=20function?= =?UTF-8?q?s=20=F0=9F=94=A8=20refactor(MainPage):=20remove=20handleSaveFlo?= =?UTF-8?q?w=20prop=20from=20MenuBar=20component=20=F0=9F=94=A8=20refactor?= =?UTF-8?q?(MainPage):=20export=20MenuBar=20component=20as=20named=20expor?= =?UTF-8?q?t=20The=20axios=20library=20is=20replaced=20with=20the=20fetch?= =?UTF-8?q?=20API=20for=20the=20getVersion=20and=20getHealth=20functions?= =?UTF-8?q?=20to=20reduce=20the=20bundle=20size=20and=20improve=20performa?= =?UTF-8?q?nce.=20The=20handleSaveFlow=20prop=20is=20removed=20from=20the?= =?UTF-8?q?=20MenuBar=20component=20as=20it=20is=20not=20used.=20The=20Men?= =?UTF-8?q?uBar=20component=20is=20now=20exported=20as=20a=20named=20expor?= =?UTF-8?q?t=20to=20improve=20code=20readability=20and=20maintainability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/controllers/API/index.ts | 4 ++-- src/frontend/src/pages/MainPage/components/menuBar/index.tsx | 2 +- src/frontend/src/pages/MainPage/index.tsx | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index a7270a7a0..910aeacf6 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -242,7 +242,7 @@ export async function saveFlowStyleToDatabase(flowStyle: FlowStyleType) { * @returns {Promise>} A promise that resolves to an AxiosResponse containing the version information. */ export async function getVersion() { - return await axios.get("/version"); + return await fetch("/version"); } /** @@ -251,5 +251,5 @@ export async function getVersion() { * @returns {Promise>} A promise that resolves to an AxiosResponse containing the health status. */ export async function getHealth() { - return await axios.get("/health"); + return await fetch("/health"); } diff --git a/src/frontend/src/pages/MainPage/components/menuBar/index.tsx b/src/frontend/src/pages/MainPage/components/menuBar/index.tsx index b87ff556a..f8a1ccce9 100644 --- a/src/frontend/src/pages/MainPage/components/menuBar/index.tsx +++ b/src/frontend/src/pages/MainPage/components/menuBar/index.tsx @@ -26,7 +26,7 @@ import ApiModal from "../../../../modals/ApiModal"; import { alertContext } from "../../../../contexts/alertContext"; import { updateFlowInDatabase } from "../../../../controllers/API"; -const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { +export const MenuBar = ({ activeTab, setRename, rename, flows, tabIndex }) => { const { updateFlow, setTabIndex, addFlow } = useContext(TabsContext); const { setErrorData } = useContext(alertContext); const { openPopUp } = useContext(PopUpContext); diff --git a/src/frontend/src/pages/MainPage/index.tsx b/src/frontend/src/pages/MainPage/index.tsx index aa3df49a7..e8ad6c097 100644 --- a/src/frontend/src/pages/MainPage/index.tsx +++ b/src/frontend/src/pages/MainPage/index.tsx @@ -63,7 +63,6 @@ export default function HomePage() { rename={rename} flows={flows} tabIndex={tabIndex} - handleSaveFlow={handleSaveFlow} />
Explore