-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hello everybody, i'm a french junior dev on apostrophecms3.
Here is my problem :
I have a customer module with a favorites field :
favorites: {
label: 'apostrophe:favorites',
type: 'array',
titleField: 'favorite',
fields: {
add: {
type: {
type: 'string',
label: 'apostrophe:favoriteType',
},
id: {
type: 'string',
label: 'apostrophe:favoriteId',
},
}
}
},
I would like to add a new favorite for this customer by clicking a button on the article page.
But i can't find the way to do it in my index.js front file.
Here is a part of my code :
favorite.addEventListener('click', () => {
addFavorite(favorite.id) // favorite.id is defined
})
async function addFavorite(favoriteId) {
const customerId = sessionStorage.getItem('aposCustomerId')
try {
???? what's going on here ????
} catch (err) {
console.error(err)
} finally {
}
}
Thanks a lot for your help !
Metadata
Metadata
Assignees
Labels
No labels