24.04 Add Notifications
This commit is contained in:
parent
3b806cff18
commit
1438e11aad
@ -102,7 +102,8 @@ module.exports = function (/* ctx */) {
|
||||
// Quasar plugins
|
||||
plugins: [
|
||||
'Dialog',
|
||||
'LocalStorage'
|
||||
'LocalStorage',
|
||||
'Notify'
|
||||
]
|
||||
},
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import { uid } from 'quasar'
|
||||
import { uid, Notify } from 'quasar'
|
||||
import { firebaseDb, firebaseAuth } from 'boot/firebase'
|
||||
import { showErrorMessage } from 'src/functions/function-show-error-message'
|
||||
|
||||
const state = {
|
||||
tasks: {
|
||||
/*
|
||||
|
||||
ID1: {
|
||||
name: 'Go to shop',
|
||||
completed: false,
|
||||
@ -24,7 +24,7 @@ const state = {
|
||||
dueDate: '2021/03/09',
|
||||
dueTime: '16:30'
|
||||
}
|
||||
*/
|
||||
|
||||
},
|
||||
search: '',
|
||||
sort: 'name',
|
||||
@ -120,6 +120,8 @@ const actions = {
|
||||
taskRef.set(payload.task, error => {
|
||||
if (error) {
|
||||
showErrorMessage(error.message)
|
||||
} else {
|
||||
Notify.create('Task added')
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -129,6 +131,11 @@ const actions = {
|
||||
taskRef.update(payload.updates, error => {
|
||||
if (error) {
|
||||
showErrorMessage(error.message)
|
||||
} else {
|
||||
const keys = Object.keys(payload.updates)
|
||||
if (keys.includes('completed') && keys.length > 1) {
|
||||
Notify.create('Task updated')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -138,6 +145,8 @@ const actions = {
|
||||
taskRef.remove(error => {
|
||||
if (error) {
|
||||
showErrorMessage(error.message)
|
||||
} else {
|
||||
Notify.create('Task deleted')
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -149,8 +158,9 @@ const getters = {
|
||||
const keysOrdered = Object.keys(state.tasks)
|
||||
|
||||
keysOrdered.sort((a, b) => {
|
||||
const taskAProp = state.tasks[a].[state.sort].toLowerCase()
|
||||
const taskBProp = state.tasks[b].[state.sort].toLowerCase()
|
||||
const sort = state.sort
|
||||
const taskAProp = state.tasks[a][sort].toLowerCase()
|
||||
const taskBProp = state.tasks[b][sort].toLowerCase()
|
||||
if (taskAProp > taskBProp) return 1
|
||||
else if (taskAProp < taskBProp) return -1
|
||||
else return 0
|
||||
|
Loading…
Reference in New Issue
Block a user