@mercadoeletronico/meweb-module
v2.3.1
Published
ME-Web Nuxt.js Module.
Downloads
169
Readme
ME Web Nuxt.js Module
Integrated middleware with ME-WEB`s Microservices.
- ME-Toolkit
- ME Vuex Store
- Auth
- GA
- i18n
Getting Started
Nuxt.js module
Nuxt.js version 2.8.1 (or greater) is recommended.
Install dependencies:
# With npm
npm i @mercadoeletronico/meweb-module
# With yarn
yarn add @mercadoeletronico/meweb-module
Add @mercadoeletronico/meweb-module
to modules section of nuxt.config.js.
module.exports = {
modules: ['@mercadoeletronico/meweb-module']
}
Auth Middleware
The MEWeb`s module provides an authentication middleware
module.exports = {
router: {
// Run the middleware/me-auth.js on every page
middleware: 'me-auth'
}
}
Built-in Vuex
ME Module
Getters
Get current user
$store.getters['me/getUser']
Get current Customer
$store.getters['me/getCustomer']
Get current locale
$store.getters['me/getLocale']
Get site map
$store.getters['me/getSiteMap']
Get available locales
$store.getters['me/getLocales']
Actions
Set current user
store.dispatch('me/setUser', {
name: 'Renato Dias',
role: 'Developer'
})
Set current customer
store.dispatch('me/setCustomer', {
idMain: 1,
header: {
logo: '',
background: {
mainImage: '',
repeatImage: '',
primaryColor: '',
secondaryColor: ''
}
}
})
Set current locale
store.dispatch('me/setLocale', 'pt-BR')
Load site-map
store.dispatch('me/loadSiteMap')
Change User-Locale
- Change User Locale on ME-WEB
- Update store
- Reload Site-map
store.dispatch('me/changeLocale', 'pt-BR')