@mapomodule/core
Advanced tools
Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
@@ -6,2 +6,19 @@ # Change Log | ||
# [1.0.0-alpha.16](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-04-03) | ||
### Features | ||
* Added mapo integrations module! 🎉 ([76d2c80](https://github.com/lotrekagency/mapo/commit/76d2c805245b4cf49a33696339da52e4c17f4053)) | ||
* added mapo options to mapo helper ([38dcbf2](https://github.com/lotrekagency/mapo/commit/38dcbf28d286eb02c2a6785a883a14edaa0837b1)) | ||
### BREAKING CHANGES | ||
* This change removes all the camomilla cms references moving the compatibility layer in a detached package [mapo-integrations-camomilla](https://github.com/lotrekagency/mapo-integrations-camomilla). The guidelines to make mapo work with camomilla will be provided in the package readme. | ||
# [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11) | ||
@@ -8,0 +25,0 @@ |
import createRepository from '@mapomodule/core/api/crud' | ||
import transformRequestInMultipart from '@mapomodule/core/api/multipart' | ||
import initInterceptors from '@mapomodule/core/interceptor' | ||
import options from './options' | ||
@@ -11,2 +12,3 @@ function getRouteMiddlewares(route) { | ||
const { axios, ...conf } = options; | ||
@@ -23,4 +25,6 @@ export default (ctx, inject) => { | ||
crud: createRepository(ctx.$axios), | ||
multipart: transformRequestInMultipart | ||
multipart: transformRequestInMultipart, | ||
conf: axios | ||
}, | ||
$options: conf, | ||
/** | ||
@@ -40,3 +44,3 @@ * From here you can reach some utilities that simplify the interaction with the user authentication flow. | ||
*/ | ||
logout: () => ctx.store.dispatch("mapo/user/login"), | ||
logout: () => ctx.store.dispatch("mapo/user/logout"), | ||
/** | ||
@@ -43,0 +47,0 @@ * This refresh user informations present in vuex store and returns them. |
import Middleware from '../../middleware' // little hack to inject middleware in root project :P | ||
Middleware.auth = Middleware.auth || function ({ route, redirect, query, store }) { | ||
const hasToken = store.getters['mapo/user/token'] | ||
if (!hasToken) { | ||
const isLoggedIn = store.getters['mapo/user/isLoggedIn'] | ||
if (!isLoggedIn) { | ||
query['redirect'] = route.path | ||
@@ -7,0 +7,0 @@ return redirect('/login', query) |
@@ -26,2 +26,9 @@ import path from 'path' | ||
// INJECT MAPO OPTIONS | ||
this.addTemplate({ | ||
src: path.resolve(__dirname, './options.js'), | ||
fileName: path.join(namespace, 'options.js'), | ||
options: { axios: (this.options && this.options.axios), ...moduleOptions } | ||
}) | ||
// INJECT ALL MIDDLEWARES | ||
@@ -28,0 +35,0 @@ const middlewares = (await resolver.resolveRelative(__dirname, 'middleware')).map(({ src }) => src) |
{ | ||
"name": "@mapomodule/core", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"description": "This is part of Mapo nuxt module. Injects the core mapo plugin helpers.", | ||
@@ -21,3 +21,3 @@ "author": "bnznamco <gabriele.baldi.01@gmail.com>", | ||
}, | ||
"gitHead": "cd42b3dd094ef3bf743c67819e6059bf9ccac491" | ||
"gitHead": "2ef4275464cd8eb28cbbc61c980355b1379186b5" | ||
} |
24063
13
384