Skip to content

Commit 678b7ca

Browse files
wip: Provide a simplified editor #1118
1 parent 075c9e9 commit 678b7ca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/client/components/KEditor.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
import _ from 'lodash'
1212
import logger from 'loglevel'
1313
import { ref } from 'vue'
14-
import { api, Context } from '@kalisio/kdk/core.client'
14+
import { api, Context, i18n } from '@kalisio/kdk/core.client'
15+
import { Notify } from 'quasar'
1516
1617
// Props
1718
const props = defineProps({
@@ -46,6 +47,10 @@ const props = defineProps({
4647
dense: {
4748
type: Boolean,
4849
default: false
50+
},
51+
notify: {
52+
type: Object,
53+
default: null
4954
}
5055
})
5156
@@ -78,9 +83,11 @@ async function apply () {
7883
if (mode === 'creation') {
7984
logger.debug('[KDK] Create object with data', response.values)
8085
await service.create(values)
86+
if (_.has(props, 'notify.created.success')) Notify.create({ type: 'positive', message: i18n.t(_.get(props, 'notify.created.success')) })
8187
} else {
8288
logger.debug(`[KDK] Patch object ${props.object._id} with data`, response.values)
8389
await service.patch(props.object._id, response.values)
90+
if (_.has(props, 'notify.updated.success')) Notify.create({ type: 'positive', message: i18n.t(_.get(props, 'notify.updated.success')) })
8491
}
8592
// run the afterRequest hook
8693
if (props.afterRequest) {
@@ -90,6 +97,8 @@ async function apply () {
9097
if (!response.isOk) return false
9198
return true
9299
} else {
100+
if (mode === 'creation' && _.has(props, 'notify.created.error')) Notify.create({ type: 'negative', message: i18n.t(_.get(props, 'notify.created.error')) })
101+
if (mode === 'edition' && _.has(props, 'notify.updated.error')) Notify.create({ type: 'negative', message: i18n.t(_.get(props, 'notify.updated.error')) })
93102
logger.debug('[KDK] Form is invalid')
94103
}
95104
}

0 commit comments

Comments
 (0)