Files
veridian/app/plugins/sync-app-state.server.ts
T

14 lines
471 B
TypeScript

export default defineNuxtPlugin(() => {
const route = useRoute();
const appState = useAppState();
if (route.params.id) {
const agentId = Array.isArray(route.params.id) ? route.params.id[0] : route.params.id;
appState.setActiveAgent(agentId);
}
if (route.params.topicId) {
const topicId = Array.isArray(route.params.topicId) ? route.params.topicId[0] : route.params.topicId;
appState.setActiveTopic(topicId);
}
});