Use message mixin for handling success and error messages (#51)
Use message mixin everywhere Add mixin for success and error messages Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/51
This commit is contained in:
@ -76,7 +76,6 @@
|
||||
<script>
|
||||
import AttachmentService from '../../../services/attachment'
|
||||
import AttachmentModel from '../../../models/attachment'
|
||||
import message from '../../../message'
|
||||
|
||||
export default {
|
||||
name: 'attachments',
|
||||
@ -153,18 +152,18 @@
|
||||
.then(r => {
|
||||
if(r.success !== null) {
|
||||
r.success.forEach(a => {
|
||||
message.success({message: 'Successfully uploaded ' + a.file.name}, this)
|
||||
this.success({message: 'Successfully uploaded ' + a.file.name}, this)
|
||||
this.attachments.push(a)
|
||||
})
|
||||
}
|
||||
if(r.errors !== null) {
|
||||
r.errors.forEach(m => {
|
||||
message.error(m, this)
|
||||
this.error(m)
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
|
||||
},
|
||||
@ -177,10 +176,10 @@
|
||||
this.attachments.splice(a, 1)
|
||||
}
|
||||
}
|
||||
message.success(r, this)
|
||||
this.success(r, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
.finally(() => {
|
||||
this.showDeleteModal = false
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
<script>
|
||||
import {differenceWith} from 'lodash'
|
||||
import message from '../../../message'
|
||||
import multiselect from 'vue-multiselect'
|
||||
|
||||
import UserModel from '../../../models/user'
|
||||
@ -88,10 +87,10 @@
|
||||
const taskAssignee = new TaskAssigneeModel({user_id: user.id, task_id: this.taskID})
|
||||
this.taskAssigneeService.create(taskAssignee)
|
||||
.then(() => {
|
||||
message.success({message: 'The user was successfully assigned.'}, this)
|
||||
this.success({message: 'The user was successfully assigned.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
removeAssignee(user) {
|
||||
@ -104,10 +103,10 @@
|
||||
this.assignees.splice(a, 1)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The user was successfully unassigned.'}, this)
|
||||
this.success({message: 'The user was successfully unassigned.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
findUser(query) {
|
||||
@ -124,7 +123,7 @@
|
||||
}))
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
clearAllFoundUsers() {
|
||||
|
@ -35,7 +35,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import message from '../../../message'
|
||||
import { differenceWith } from 'lodash'
|
||||
import multiselect from 'vue-multiselect'
|
||||
|
||||
@ -101,7 +100,7 @@
|
||||
this.labelTimeout = null
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
}, 300)
|
||||
},
|
||||
@ -112,10 +111,10 @@
|
||||
let labelTask = new LabelTaskModel({taskID: this.taskID, label_id: label.id})
|
||||
this.labelTaskService.create(labelTask)
|
||||
.then(() => {
|
||||
message.success({message: 'The label was successfully added.'}, this)
|
||||
this.success({message: 'The label was successfully added.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
removeLabel(label) {
|
||||
@ -128,10 +127,10 @@
|
||||
this.labels.splice(l, 1)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The label was successfully removed.'}, this)
|
||||
this.success({message: 'The label was successfully removed.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
createAndAddLabel(title) {
|
||||
@ -142,7 +141,7 @@
|
||||
this.labels.push(r)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -79,7 +79,6 @@
|
||||
import TaskRelationModel from '../../../models/taskRelation'
|
||||
|
||||
import multiselect from 'vue-multiselect'
|
||||
import message from '../../../message'
|
||||
|
||||
export default {
|
||||
name: 'relatedTasks',
|
||||
@ -138,7 +137,7 @@
|
||||
this.$set(this, 'foundTasks', response)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
clearAllFoundTasks() {
|
||||
@ -158,10 +157,10 @@
|
||||
this.relatedTasks[this.newTaskRelationKind].push(this.newTaskRelationTask)
|
||||
this.newTaskRelationKind = 'unset'
|
||||
this.newTaskRelationTask = new TaskModel()
|
||||
message.success({message: 'The task relation was created successfully'}, this)
|
||||
this.success({message: 'The task relation was created successfully'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
removeTaskRelation() {
|
||||
@ -179,10 +178,10 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
message.success(r, this)
|
||||
this.success(r, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
.finally(() => {
|
||||
this.showDeleteModal = false
|
||||
|
Reference in New Issue
Block a user