Я получаю сообщение об ошибке в окне cmd webpack, когда запускаю npm run dev
для проекта.
Вот код и сообщение об ошибке, которое я получаю конкретно, код, относящийся к родительской вершине-уровневый компонент Vue, в котором есть панель навигации, в которой есть детали, которые меняются в зависимости от того, вошел ли пользователь в систему:
Код
<script>
// import required components
import EventBus from './components/EventBus'
import router from './router/index.js'
import jwtDecode from 'jwt-decode'
export default {
data () {
const token = localStorage.usertoken
const decoded = jwtDecode(token)
return {
first_name: '',
surname: '',
email: '',
created: ''
}
return {
auth: false
}
try {
this.login()
} catch (error) {
console.log('Not currently signed in')
}
},
methods: {
logout () {
this.first_name = ''
this.surname = ''
this.email = ''
this.created = ''
localStorage.removeItem('usertoken')
this.auth = false
router.push({
name: 'login'
})
},
login () {
this.first_name = this.decoded.f_name
this.surname = this.decoded.s_name
this.email = this.decoded.email
this.created = this.decoded.created
}
},
mounted () {
EventBus.$on('logged-in', status => {
this.auth = status
this.login()
})
}
}
</script>
И сообщение об ошибке
✘ http://eslint.org/docs/rules/no-unused-vars 'decoded' is assigned a value but never used
src\App.vue:60:11
const decoded = null
Мне кажется, decoded
используется в login()
, есть идеи?