forked from mosaicstack/stack
feat(cli): add login command and authenticated TUI sessions (#114)
Co-authored-by: Jason Woltje <[email protected]> Co-committed-by: Jason Woltje <[email protected]>
This commit is contained in:
@@ -12,9 +12,14 @@ interface Message {
|
||||
interface TuiAppProps {
|
||||
gatewayUrl: string;
|
||||
conversationId?: string;
|
||||
sessionCookie?: string;
|
||||
}
|
||||
|
||||
export function TuiApp({ gatewayUrl, conversationId: initialConversationId }: TuiAppProps) {
|
||||
export function TuiApp({
|
||||
gatewayUrl,
|
||||
conversationId: initialConversationId,
|
||||
sessionCookie,
|
||||
}: TuiAppProps) {
|
||||
const { exit } = useApp();
|
||||
const [messages, setMessages] = useState<Message[]>([]);
|
||||
const [input, setInput] = useState('');
|
||||
@@ -27,6 +32,7 @@ export function TuiApp({ gatewayUrl, conversationId: initialConversationId }: Tu
|
||||
useEffect(() => {
|
||||
const socket = io(`${gatewayUrl}/chat`, {
|
||||
transports: ['websocket'],
|
||||
extraHeaders: sessionCookie ? { Cookie: sessionCookie } : undefined,
|
||||
});
|
||||
|
||||
socketRef.current = socket;
|
||||
|
||||
Reference in New Issue
Block a user