feat(API): add postStoreComponents function to handle POST request for storing components in the API
This commit is contained in:
parent
9c10f11fa1
commit
111ddb1d8c
1 changed files with 13 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import { BASE_URL_API } from "../../constants/constants";
|
||||||
import { api } from "../../controllers/API/api";
|
import { api } from "../../controllers/API/api";
|
||||||
import {
|
import {
|
||||||
APIObjectType,
|
APIObjectType,
|
||||||
|
Component,
|
||||||
LoginType,
|
LoginType,
|
||||||
Users,
|
Users,
|
||||||
changeUser,
|
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) {
|
export async function getComponent(component_id: string) {
|
||||||
try {
|
try {
|
||||||
const res = await api.get(
|
const res = await api.get(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue