Only load tasks when the user is authenticated
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kolaente 2020-06-21 17:42:08 +02:00
parent 8a7ecfa3bb
commit ce277b64ee
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,7 @@
import TaskService from '../../services/task'
import SingleTaskInList from '../../components/tasks/partials/singleTaskInList'
import {HAS_TASKS} from '../../store/mutation-types'
import {mapState} from 'vuex'
export default {
name: 'ShowTasks',
@ -43,8 +44,18 @@
watch: {
'$route': 'loadPendingTasks',
},
computed: mapState({
userAuthenticated: state => state.auth.authenticated,
}),
methods: {
loadPendingTasks() {
// Since this route is authentication only, users would get an error message if they access the page unauthenticated.
// Since this component is mounted as the home page before unauthenticated users get redirected
// to the login page, they will almost always see the error message.
if (!this.userAuthenticated) {
return
}
const params = {
sort_by: ['due_date_unix', 'id'],
order_by: ['desc', 'desc'],