mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2024-12-27 02:43:45 +02:00
clean up
This commit is contained in:
parent
2d84b582cc
commit
081bfd9ba8
@ -13,14 +13,12 @@ const Console = ({serverStatus}) => {
|
||||
const socket = new WebSocket(ws_scheme + "://" + window.location.host + "/ws");
|
||||
|
||||
socket.onopen = function (e) {
|
||||
console.log("Socket Open")
|
||||
socket.send(JSON.stringify({name: "log subscribe"}));
|
||||
setSocket(socket)
|
||||
};
|
||||
|
||||
socket.onmessage = e => {
|
||||
const {name, data} = JSON.parse(e.data)
|
||||
console.log(name)
|
||||
switch (name) {
|
||||
case 'log update':
|
||||
setLogs(oldLogs => [...oldLogs, data])
|
||||
@ -31,7 +29,7 @@ const Console = ({serverStatus}) => {
|
||||
}
|
||||
|
||||
socket.onerror = e => {
|
||||
console.log(e)
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
consoleInput.current?.focus();
|
||||
|
@ -1,8 +1,6 @@
|
||||
import React, {useEffect, useState} from "react";
|
||||
import saveClient from "../../../api/resources/saves";
|
||||
import savesResource from "../../../api/resources/saves";
|
||||
import Panel from "../../components/Panel";
|
||||
import ButtonLink from "../../components/ButtonLink";
|
||||
import Button from "../../components/Button";
|
||||
import CreateSaveForm from "./components/CreateSaveForm";
|
||||
import UploadSaveForm from "./components/UploadSaveForm";
|
||||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||
@ -12,11 +10,14 @@ const Saves = ({serverStatus}) => {
|
||||
|
||||
const [saves, setSaves] = useState([]);
|
||||
|
||||
const updateList = async () => {
|
||||
const res = await saveClient.list();
|
||||
if (res.success) {
|
||||
setSaves(res.data);
|
||||
}
|
||||
const updateList = () => {
|
||||
savesResource.list()
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
setSaves(res.data);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@ -24,7 +25,7 @@ const Saves = ({serverStatus}) => {
|
||||
}, []);
|
||||
|
||||
const deleteSave = async (save) => {
|
||||
const res = await saveClient.delete(save);
|
||||
const res = await savesResource.delete(save);
|
||||
if (res.success) {
|
||||
updateList()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user