From 6f734fee28061d41746cd00c7f91fcd07a0d68d4 Mon Sep 17 00:00:00 2001 From: cnouguier Date: Sat, 27 Jul 2024 18:02:25 +0200 Subject: [PATCH] wip: Provide a messages service #908 --- core/client/composables/index.js | 1 + core/client/composables/messages.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 core/client/composables/messages.js diff --git a/core/client/composables/index.js b/core/client/composables/index.js index de5163b16..4a51cf48b 100644 --- a/core/client/composables/index.js +++ b/core/client/composables/index.js @@ -1,6 +1,7 @@ export * from './activity.js' export * from './collection.js' export * from './layout.js' +export * from './messages.js' export * from './pwa.js' export * from './session.js' export * from './schema.js' diff --git a/core/client/composables/messages.js b/core/client/composables/messages.js new file mode 100644 index 000000000..74e4a02ff --- /dev/null +++ b/core/client/composables/messages.js @@ -0,0 +1,15 @@ +import { api } from '../api.js' + +export function useMessages (contextId) { + const messagesService = api.getService('messages', contextId) + + // Functions + async function createMessage (message) { + return messagesService.create(message) + } + + // Expose + return { + createMessage + } +}