Skip to content

Commit 38f8bc3

Browse files
committed
wip
1 parent 242dd9a commit 38f8bc3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/pages/event-stream.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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;

types/nextjs-routes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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">

0 commit comments

Comments
 (0)