File size: 465 Bytes
63522a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { useNavigation } from "#/context/navigation-context";

export function useOptionalConversationId() {
  const { conversationId } = useNavigation();

  return { conversationId };
}

export function useConversationId() {
  const { conversationId } = useOptionalConversationId();

  if (!conversationId) {
    throw new Error(
      "useConversationId must be used within a route that has a conversationId parameter",
    );
  }

  return { conversationId };
}