Plugins
Vue Storefront integration for SAP Commerce Cloud ships with a default set of Nuxt plugins (opens new window). Some of them are added inside your Nuxt theme and some are injected under the hood by the @vsf-enterprise/sapcc/nuxt module.
Theme plugins
notifications
The notifications plugin centralizes the logic responsible for displaying UI notifications to the users. Read more about it in our guide on handling notifications.
image-helpers
The image-helpers plugin provides you with methods facilitating your work with SAP images and the @nuxt/image module in combination with Cloudinary (opens new window). Read more about it in our guide on working with images.
Module plugins
loadStore
The loadStore plugin is responsble for:
- loading the Base Store configuration server-side, before the root Vue.js Application is instantiated
- saving the default Base Store currency in the vsf-currency cookie
- saving the default Base Store language in the vsf-locale cookie
- redirecting the user to the default locale (equal to the default Base Store language)
The plugin leverages the useStore composable under the hood. The pre-loaded Base Store is saved in its store property. Therefore, there is no need for you to re-fetch it - say - in the default.vue layout if you want to use it later.
Good to know
You can disable the plugin by setting the loadStorePlugin option of the @vsf-enterprise/sapcc/nuxt module to false. Be aware it might affect the existing application flow.
refresh-token-interceptor
The refresh-token-interceptor plugin is responsible for registering an Axios interceptor (opens new window) for catching 401: Unauthorized errors and:
- refreshing the expired
access_tokenby using the associatedrefresh_tokento extend the ongoing user session - terminating the user session gracefully when the
refresh_tokenturns out to be invalid (e.g. in case of simultaneous login on two different devices)
Read more about the entire flow in our guide on session management.
Good to know
Currently, there is no way to disable the plugin but such an option will be provided in one of the upcoming releases.