Commit 6a0b13e8 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

lint fixed

parent ffa01ab4
...@@ -29,32 +29,30 @@ ...@@ -29,32 +29,30 @@
</div> </div>
</template> </template>
<script> <script>
import SideBar from '@/components/SideBar'
export default { export default {
components: { components: {
Sidebar SideBar
}, },
methods: { methods: {
logout() { logout () {
fetch('http://127.0.0.1:8000/api/logout', { fetch('http://127.0.0.1:8000/api/logout', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
accept: 'application/json', accept: 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
token: this.$auth.$storage.getUniversal('token'), token: this.$auth.$storage.getUniversal('token')
}), })
}); })
localStorage.setItem('token', '') localStorage.setItem('token', '')
this.$auth.$storage.setUniversal('loggedIn', 'false') this.$auth.$storage.setUniversal('loggedIn', 'false')
this.$auth.$storage.setUniversal('token', '') this.$auth.$storage.setUniversal('token', '')
this.$auth.$storage.setUniversal('userName', '') this.$auth.$storage.setUniversal('userName', '')
this.$router.push('/login') this.$router.push('/login')
}, }
}, }
} }
</script> </script>
<style>
</style>
...@@ -14,11 +14,7 @@ ...@@ -14,11 +14,7 @@
<script> <script>
export default { export default {
name: 'SideBar', name: 'SideBar',
} data () {
</script>
<script>
export default {
data() {
return { return {
variant: 'dark', variant: 'dark',
variants: [ variants: [
...@@ -31,9 +27,9 @@ export default { ...@@ -31,9 +27,9 @@ export default {
'success', 'success',
'danger', 'danger',
'warning', 'warning',
'info', 'info'
], ]
}; }
}, }
} }
</script> </script>
<template> <template>
<div> <div>
<Navbar /> <NavBar />
<nuxt /> <nuxt />
</div> </div>
</template> </template>
<script> <script>
import Navbar from '@/components/Navbar' import NavBar from '@/components/NavBar'
export default { export default {
components: { Navbar }, components: {
}; NavBar
}
}
</script> </script>
export default ({ redirect }) => { export default ({ redirect }) => {
if (localStorage.getItem('token') == '') { if (typeof localStorage !== 'undefined' && !localStorage.getItem('token')) {
return redirect('/login') return redirect('/login')
} }
} }
\ No newline at end of file
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