@mapomodule/core
Advanced tools
Comparing version 1.0.0-alpha.30 to 1.0.0-alpha.31
@@ -6,2 +6,14 @@ # Change Log | ||
# [1.0.0-alpha.31](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-09-14) | ||
### Bug Fixes | ||
* **interceptor:** remove token injection for axios requests ([59b2f5c](https://github.com/lotrekagency/mapo/commit/59b2f5cb3dfd0becd78df02f30bc32967643e276)) | ||
* **middleware:** fix auth middleware to correclty redirect based on router base ([1d49cd7](https://github.com/lotrekagency/mapo/commit/1d49cd72e141888ef7aae91ac0ddb13f8d0fce7a)) | ||
# [1.0.0-alpha.30](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-09-13) | ||
@@ -8,0 +20,0 @@ |
module.exports = ({ $axios, store }) => { | ||
if ($axios && store) { | ||
$axios.onRequest((config) => { | ||
const token = store.getters['mapo/user/token'] | ||
if (token && token !== 'undefined') { | ||
config.headers['Authorization'] = `Token ${token}` | ||
} | ||
return config | ||
}) | ||
$axios.onResponse((response) => { | ||
@@ -12,0 +4,0 @@ if (response.status === 401) { |
import Middleware from '../../middleware' // little hack to inject middleware in root project :P | ||
Middleware.auth = Middleware.auth || function ({ route, redirect, query, store }) { | ||
Middleware.auth = Middleware.auth || function ({ route, redirect, query, store, app }) { | ||
const { router: { options } } = app; | ||
const isLoggedIn = store.getters['mapo/user/isLoggedIn'] | ||
if (!isLoggedIn) { | ||
query['redirect'] = route.path | ||
return redirect('/login', query) | ||
return redirect(`${options.base || '/'}login`, query) | ||
} | ||
} |
{ | ||
"name": "@mapomodule/core", | ||
"version": "1.0.0-alpha.30", | ||
"version": "1.0.0-alpha.31", | ||
"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": "f648aac2fc02b28e687f4631cfbaf4cde6999a8b" | ||
"gitHead": "fe25f51c0ef03764bca9d9b2b123f0729d71d13e" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25764
370