Skip to content

Commit

Permalink
remove unused getServers; fix undefined details
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoBrigitte committed Nov 7, 2024
1 parent b6a7ee3 commit bd00e55
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions front/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import React from 'react'
import ServersTable from './components/server';
import useSWRSubscription from 'swr/subscription';

const getServers = () => fetch('http://127.0.0.1:8080/list').then(res => res.json());

function Status({ error, data, connectionRestored, setConnectionRestored }) {
let message;
let fadeOut;

if (error) {
message = "Failed to load server list"
details = <div className="text-orange-700">{error.toString()}</div>
message =
<>
<div>Failed to load server list</div>
<div className="text-orange-700">{error.toString()}</div>
</>
} else if (!data||data==undefined) {
message = <div>Loading ...</div>
} else if (connectionRestored) {
Expand All @@ -37,7 +38,7 @@ export default function Home() {
const [connectionRestored, setConnectionRestored] = React.useState(false);

const startWS = (key, { next }) => {
let socket = new WebSocket("ws://127.0.0.1:8080/listWS",'echo-protocol');
let socket = new WebSocket("ws://127.0.0.1:8080/listWS", 'echo-protocol');
socket.addEventListener('message', (event) => {
const res = JSON.parse(event.data)
next(null, res)
Expand Down

0 comments on commit bd00e55

Please sign in to comment.