Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS ISSUE] Page: Front end helper methods #226

Open
Fabien-Scetbon opened this issue Jul 29, 2022 · 0 comments
Open

[DOCS ISSUE] Page: Front end helper methods #226

Fabien-Scetbon opened this issue Jul 29, 2022 · 0 comments

Comments

@Fabien-Scetbon
Copy link

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant