// Get all extras and filter by ID
const getExtraById = async (extraId) => {
const response = await fetch('https://api.example.com/extra/get', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
});
const data = await response.json();
const extra = data.result.find(item => item.id_extra === extraId);
return extra;
};
// Usage
const extra = await getExtraById(3);
{
"id_extra": 3,
"name": "Silla Plástica",
"value_add": 5000,
"quantity": 50
}
Get details of a specific extra item
// Get all extras and filter by ID
const getExtraById = async (extraId) => {
const response = await fetch('https://api.example.com/extra/get', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
});
const data = await response.json();
const extra = data.result.find(item => item.id_extra === extraId);
return extra;
};
// Usage
const extra = await getExtraById(3);
{
"id_extra": 3,
"name": "Silla Plástica",
"value_add": 5000,
"quantity": 50
}
GET /extra/get. To get a specific extra, you would need to filter the results from the list endpoint by id_extra.GET /extra/get endpoint that returns all extras, you can retrieve a specific extra by:
GET /extra/get)id_extra// Get all extras and filter by ID
const getExtraById = async (extraId) => {
const response = await fetch('https://api.example.com/extra/get', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
});
const data = await response.json();
const extra = data.result.find(item => item.id_extra === extraId);
return extra;
};
// Usage
const extra = await getExtraById(3);
{
"id_extra": 3,
"name": "Silla Plástica",
"value_add": 5000,
"quantity": 50
}