Files
frontend-lblod-chat/app/routes/conversation.js
2026-09-16 17:16:19 +02:00

23 lines
604 B
JavaScript

import Route from '@ember/routing/route';
import { service } from '@ember/service';
export default class ConversationRoute extends Route {
@service session;
@service store;
beforeModel(transition) {
this.session.requireAuthentication(transition, 'login');
}
async model({ id }) {
const [conversation, agents] = await Promise.all([
this.store.findRecord('chat-conversation', id, {
include: 'messages.attachments',
reload: true,
}),
this.store.query('chat-agent', { 'page[size]': 1 }),
]);
return { conversation, assistant: agents[0] };
}
}