Commit ac29aa6b authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

add name category + user creen post

parent 51ae5777
export default function(context) { export default function (context) {
console.log('[LOG]: middleware is running ...') console.log('[LOG]: middleware is running ...')
} }
export default ({ redirect }) => { export default ({ redirect, store }) => {
if (typeof localStorage !== 'undefined' && !localStorage.getItem('token')) { if (typeof localStorage !== 'undefined' && !localStorage.getItem('token')) {
return redirect('/login') return redirect('/login')
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -279,6 +279,9 @@ export default { ...@@ -279,6 +279,9 @@ export default {
this.initialize() this.initialize()
this.getUsers() this.getUsers()
}, },
beforeCreate () {
// this.keepToken()
},
methods: { methods: {
initialize () { initialize () {
this.users = [] this.users = []
......
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
Vue.mixin({ Vue.mixin({
methods: { methods: {
...@@ -12,6 +14,11 @@ Vue.mixin({ ...@@ -12,6 +14,11 @@ Vue.mixin({
if (day.length < 2) { day = '0' + day } if (day.length < 2) { day = '0' + day }
return [year, month, day].join('-') return [year, month, day].join('-')
},
keepToken () {
const TOKEN = localStorage.getItem('token')
this.$auth.$storage.setUniversal('token', TOKEN)
} }
} }
}) })
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export const store = new Vuex.Store({
modules: {
}
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment