summaryrefslogtreecommitdiff
path: root/frontend/src/Log.js
blob: 565396f6698ea7d51db7dfd4ba80d892e2ea2a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import React from 'react';
import useSSE from './useSSE';
import LogComponent from './LogComponent'; // Import the DataDisplay component

const Log = () => {
    const { data, error } = useSSE('http://localhost:8000/data_stream', 2000);
  
    console.log("Log Data: ", data);

    return (
      <div className="text-white">
        {error && <p>Error: {error}</p>}
        {data ? <LogComponent messages={data.log} /> : <p>Loading data...</p>}
      </div>
    );
  };

export default Log;