const getters = {
	storeId: state => state.app.storeId,
	platform: state => state.app.platform,
	token: state => state.user.token,
	userId: state => state.user.userId,
	userInfo: state => state.user.userInfo,
	refereeId: state => state.app.refereeId,
	appTheme: state => state.theme.appTheme,
	socket: state => state.chat.socket,
	conversations: state => state.chat.conversations,
	conversationArr: state => {
		const keys = Object.keys(state.chat.conversations)
		const arr = keys.map(item=>{
			return state.chat.conversations[item]
		})
		arr.sort((a, b) => {
			return new Date(b.updateTime) - new Date(a.updateTime) 
		})
		return arr
		
	},
	friends: state=> state.chat.friends,
	unReadMessageCount: state => {
		let count = 0;
		const friendIds = Object.keys(state.chat.conversations);
		for (let i = 0; i < friendIds.length; i++) {
			count += state.chat.conversations[friendIds[i]].unRead
		}
		return count
	},
	unReadCommentNumber: state => state.chat.unReadCommentNumber,
	unReadLikeNumber: state => state.chat.unReadLikeNumber,
	unReadLikeMeNumber: state => state.chat.unReadLikeMeNumber,
	unReadLookNumber: state => state.chat.unReadLookNumber,
}

export default getters