chore: Replace multiple mixins to simgle use composables

This commit is contained in:
Fayaz Ahmed
2024-08-05 15:41:45 +05:30
parent b4b308336f
commit 0bd62cf33f
10 changed files with 488 additions and 0 deletions
@@ -0,0 +1,22 @@
import { computed } from 'vue';
/**
* Composable for handling message-related computations.
* @param {Object} message - The message object to be processed.
* @returns {Object} An object containing computed properties for message content and attachments.
*/
export function useMessage(message) {
const messageContentAttributes = computed(() => {
const { content_attributes: attribute = {} } = message;
return attribute;
});
const hasAttachments = computed(() => {
return !!(message.attachments && message.attachments.length > 0);
});
return {
messageContentAttributes,
hasAttachments,
};
}