chat-ui_test / src /routes /r /[id] /+page.server.ts
victor's picture
victor HF staff
Prettier update (#54)
5da61b4 unverified
raw
history blame
418 Bytes
import type { PageServerLoad } from "./$types";
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
export const load: PageServerLoad = async ({ params }) => {
const conversation = await collections.sharedConversations.findOne({
_id: params.id,
});
if (!conversation) {
throw error(404, "Conversation not found");
}
return {
messages: conversation.messages,
};
};