From 111ddb1d8ca7cc9a6a2da88dfc856b27628d5c80 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Thu, 16 Nov 2023 15:33:51 -0300 Subject: [PATCH] feat(API): add postStoreComponents function to handle POST request for storing components in the API --- src/frontend/src/controllers/API/index.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 5b2494bbd..1ea4f15e2 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -4,6 +4,7 @@ import { BASE_URL_API } from "../../constants/constants"; import { api } from "../../controllers/API/api"; import { APIObjectType, + Component, LoginType, Users, changeUser, @@ -661,6 +662,18 @@ export async function getStoreComponents({ } } +export async function postStoreComponents(component: Component) { + try { + const res = await api.post(`${BASE_URL_API}store/components/`, component); + if (res.status === 200) { + return res.data; + } + } catch (error) { + console.log("Error:", error); + throw error; + } +} + export async function getComponent(component_id: string) { try { const res = await api.get(