feat(API): add postStoreComponents function to handle POST request for storing components in the API

This commit is contained in:
cristhianzl 2023-11-16 15:33:51 -03:00
commit 111ddb1d8c

View file

@ -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(