File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from "react" ;
2+
3+ import { Container } from "@mui/material" ;
4+
5+ // {
6+ // "id": 1,
7+ // "read_token": "gsrPDunJnCvm3gZJzUa92Z"
8+ // }
9+
10+ export const Configuration = ( ) => {
11+ const [ message , setMessage ] = useState ( "" ) ;
12+
13+ useEffect ( ( ) => {
14+ new EventSource ( "/api/as-api/event-stream/1" ) . onmessage = ( event ) => {
15+ setMessage ( event . data ) ;
16+ console . log ( event ) ;
17+ } ;
18+ } ) ;
19+
20+ return (
21+ < Container >
22+ < h1 > Event Stream</ h1 >
23+ { message }
24+ </ Container >
25+ ) ;
26+ } ;
27+
28+ export default Configuration ;
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ declare module "nextjs-routes" {
3535 | StaticRoute < "/docs/how-to/results" >
3636 | StaticRoute < "/docs/how-to/usage-quotas" >
3737 | StaticRoute < "/docs/jobs" >
38+ | StaticRoute < "/event-stream" >
3839 | DynamicRoute < "/organisation/[organisationId]/inventory" , { "organisationId" : string } >
3940 | DynamicRoute < "/product/[productId]/charges" , { "productId" : string } >
4041 | StaticRoute < "/products" >
You can’t perform that action at this time.
0 commit comments