🔨 refactor(API): replace axios with fetch for getVersion and getHealth functions

🔨 refactor(MainPage): remove handleSaveFlow prop from MenuBar component
🔨 refactor(MainPage): export MenuBar component as named export
The axios library is replaced with the fetch API for the getVersion and getHealth functions to reduce the bundle size and improve performance. The handleSaveFlow prop is removed from the MenuBar component as it is not used. The MenuBar component is now exported as a named export to improve code readability and maintainability.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-09 17:59:29 -03:00
commit c76ee24a78
3 changed files with 3 additions and 4 deletions

View file

@ -242,7 +242,7 @@ export async function saveFlowStyleToDatabase(flowStyle: FlowStyleType) {
* @returns {Promise<AxiosResponse<any>>} 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<AxiosResponse<any>>} A promise that resolves to an AxiosResponse containing the health status.
*/
export async function getHealth() {
return await axios.get("/health");
return await fetch("/health");
}

View file

@ -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);

View file

@ -63,7 +63,6 @@ export default function HomePage() {
rename={rename}
flows={flows}
tabIndex={tabIndex}
handleSaveFlow={handleSaveFlow}
/>
<div className="flex">
<TabsTrigger value="community">Explore</TabsTrigger>