chat-aww / src /routes /r /[id] /+page.server.ts
coyotte508's picture
coyotte508 HF staff
Share convos (#35)
fc15a4c unverified
raw
history blame
353 Bytes
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
};
}