2 lines
841 B
JavaScript
2 lines
841 B
JavaScript
"use strict";var e=Object.defineProperty,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,t=(s,a,r)=>a in s?e(s,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[a]=r,n=(e,n)=>{for(var o in n||(n={}))a.call(n,o)&&t(e,o,n[o]);if(s)for(var o of s(n))r.call(n,o)&&t(e,o,n[o]);return e};const o=require("../common/vendor.js"),u={unreadMessages:[],readMessages:[]},l=o.defineStore("message",(()=>{const e=o.ref(n({},u)),s=o.computed((()=>e.value.unreadMessages.length));return{messages:e,setUnreadMessages:s=>{e.value.unreadMessages=s},markMessageAsRead:s=>{const a=e.value.unreadMessages.findIndex((e=>e.id===s));if(-1!==a){const s=e.value.unreadMessages.splice(a,1)[0];e.value.readMessages.push(s)}},unreadCount:s,clearMessages:()=>{e.value=n({},u)}}}));exports.useMessageStore=l;
|