@mapomodule/core 1.0.0-alpha.15 → 1.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/index.js +6 -2
- package/middleware/auth.js +2 -2
- package/module.js +7 -0
- package/options.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.16](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-04-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Added mapo integrations module! 🎉 ([76d2c80](https://github.com/lotrekagency/mapo/commit/76d2c805245b4cf49a33696339da52e4c17f4053))
|
|
12
|
+
* added mapo options to mapo helper ([38dcbf2](https://github.com/lotrekagency/mapo/commit/38dcbf28d286eb02c2a6785a883a14edaa0837b1))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### BREAKING CHANGES
|
|
16
|
+
|
|
17
|
+
* 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.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
|
|
7
24
|
|
|
8
25
|
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import createRepository from '@mapomodule/core/api/crud'
|
|
2
2
|
import transformRequestInMultipart from '@mapomodule/core/api/multipart'
|
|
3
3
|
import initInterceptors from '@mapomodule/core/interceptor'
|
|
4
|
+
import options from './options'
|
|
4
5
|
|
|
5
6
|
function getRouteMiddlewares(route) {
|
|
6
7
|
const meta = Array.isArray(route?.meta) ? route.meta[0] : route.meta
|
|
@@ -8,6 +9,7 @@ function getRouteMiddlewares(route) {
|
|
|
8
9
|
return (typeof middleware === "string" ? [middleware] : middleware) || []
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
const { axios, ...conf } = options;
|
|
11
13
|
|
|
12
14
|
export default (ctx, inject) => {
|
|
13
15
|
|
|
@@ -19,8 +21,10 @@ export default (ctx, inject) => {
|
|
|
19
21
|
*/
|
|
20
22
|
$api: {
|
|
21
23
|
crud: createRepository(ctx.$axios),
|
|
22
|
-
multipart: transformRequestInMultipart
|
|
24
|
+
multipart: transformRequestInMultipart,
|
|
25
|
+
conf: axios
|
|
23
26
|
},
|
|
27
|
+
$options: conf,
|
|
24
28
|
/**
|
|
25
29
|
* From here you can reach some utilities that simplify the interaction with the user authentication flow.
|
|
26
30
|
*/
|
|
@@ -35,7 +39,7 @@ export default (ctx, inject) => {
|
|
|
35
39
|
*
|
|
36
40
|
* This simply commits a logout to the vuex store.
|
|
37
41
|
*/
|
|
38
|
-
logout: () => ctx.store.dispatch("mapo/user/
|
|
42
|
+
logout: () => ctx.store.dispatch("mapo/user/logout"),
|
|
39
43
|
/**
|
|
40
44
|
* This refresh user informations present in vuex store and returns them.
|
|
41
45
|
* @returns {UserData}
|
package/middleware/auth.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Middleware from '../../middleware' // little hack to inject middleware in root project :P
|
|
2
2
|
|
|
3
3
|
Middleware.auth = Middleware.auth || function ({ route, redirect, query, store }) {
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
4
|
+
const isLoggedIn = store.getters['mapo/user/isLoggedIn']
|
|
5
|
+
if (!isLoggedIn) {
|
|
6
6
|
query['redirect'] = route.path
|
|
7
7
|
return redirect('/login', query)
|
|
8
8
|
}
|
package/module.js
CHANGED
|
@@ -23,6 +23,13 @@ export default async function (moduleOptions) {
|
|
|
23
23
|
fileName: path.join(namespace, 'mapo.js')
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
+
// INJECT MAPO OPTIONS
|
|
27
|
+
this.addTemplate({
|
|
28
|
+
src: path.resolve(__dirname, './options.js'),
|
|
29
|
+
fileName: path.join(namespace, 'options.js'),
|
|
30
|
+
options: { axios: (this.options && this.options.axios), ...moduleOptions }
|
|
31
|
+
})
|
|
32
|
+
|
|
26
33
|
// INJECT ALL MIDDLEWARES
|
|
27
34
|
const middlewares = (await resolver.resolveRelative(__dirname, 'middleware')).map(({ src }) => src)
|
|
28
35
|
|
package/options.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default <%= serializeFunction(options) %>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.16",
|
|
4
4
|
"description": "This is part of Mapo nuxt module. Injects the core mapo plugin helpers.",
|
|
5
5
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "2ef4275464cd8eb28cbbc61c980355b1379186b5"
|
|
22
22
|
}
|