File size: 353 Bytes
fc15a4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { collections } from '$lib/server/database.js';
import { error } from '@sveltejs/kit';

export async function load({ params }) {
	const conversation = await collections.conversations.findOne({
		'shares.id': params.id
	});

	if (!conversation) {
		throw error(404, 'Conversation not found');
	}

	return {
		messages: conversation.messages
	};
}