A
Alokai•14mo ago
Caroline

How to extension api for VSF

I was added extension on middleware.config.js like: integrations: { magento: { location: '@vue-storefront/magento-api/server', extensions: (extensions) => [ ...extensions, { name: 'extension-name', extendApiMethods: { customMethod: async (context, params) => { const response = await context.client.mutate({ mutation: gql${CUSTOMER_METHOD}, variables, fetchPolicy: 'no-cache', context: { req: context.req, res: context.res } }); } } } ], }, }, then I was called the customMethod on .vue file, like: import { useVSFContext, onSSR } from '@vue-storefront/core'; export default { setup() { const { $magento} = useVSFContext(); onSSR(async () => { await $magento.api.customMethod({ query: 'test', limit: 20 }) }); } } But when I console.log($magento), the $magento is undefined. I don't know why the $magento is undefined.
9 Replies
chinhnc
chinhnc•4w ago
@Caroline Are you resolve it ?
addff
addff•4w ago
I have a quick question I've been trying to get answered for weeks does it still make sense to do a vue storefront setup with magento 2 if you don't plan on using the paid version?
chinhnc
chinhnc•3w ago
I think you don't should
Siber
Siber•3w ago
@addff No, it does not make sense anymore. Unless you go enterprise, there might be better options available. This project and support once was very awesome. Now it is very enterprise focused and with most of your challenges and questions you would be alone.
addff
addff•3w ago
@Siber thanks for letting me know. Anything you would recommend?
Siber
Siber•2w ago
@addff It depends a lot on the requirements, skill level of the team, budget etc. But I recommend researching Adobe PWA Studio and also ScandiPWA.
addff
addff•2w ago
Ok thanks I'll look into them also have you heard of Medusa.js?
Siber
Siber•2w ago
Nope. Did look into it and seems very interesting. 🙂
Raverswag
Raverswag•4d ago
Who’s ready to escape from working from 9-5? How will you feel living a luxury lifestyle without depending on your family or parent ? Why can’t you retire yourself being in poverty zone and retire your parents as well Just hit me up with “I’m ready

Did you find this page helpful?