mirror of
https://github.com/CyberL1/dlinux-dashboard.git
synced 2025-01-22 01:19:18 -05:00
chore: add ts-ignore where needed
This commit is contained in:
parent
e47e87199f
commit
238c5a2cec
@ -8,6 +8,7 @@ export default function ContainerInfo() {
|
||||
useEffect(() => {
|
||||
const updateInfo = async () => {
|
||||
const stats = await fetch(`https://api.ssh.surf/info`, {
|
||||
// @ts-ignore
|
||||
headers: { "x-ssh-auth": localStorage.getItem("key") },
|
||||
});
|
||||
|
||||
|
@ -9,6 +9,7 @@ export default function Login() {
|
||||
const data = Object.fromEntries(formData);
|
||||
|
||||
const hello = await fetch(`https://api.ssh.surf/hello`, {
|
||||
// @ts-ignore
|
||||
headers: { "x-ssh-auth": data.key },
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@ export default function WebTerminal() {
|
||||
terminal.dispose();
|
||||
};
|
||||
}
|
||||
}, []);
|
||||
}, [container]);
|
||||
|
||||
return <div ref={terminalRef} style={{ height: "auto" }} />;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import TerminalPage from "./pages/container/terminal.tsx";
|
||||
|
||||
async function loader() {
|
||||
const info = await fetch(`https://api.ssh.surf/info`, {
|
||||
// @ts-ignore
|
||||
headers: { "x-ssh-auth": localStorage.getItem("key") },
|
||||
});
|
||||
|
||||
|
@ -6,15 +6,15 @@ import ContainerInfo from "../../components/ContainerInfo";
|
||||
|
||||
export default function ContainerPage() {
|
||||
let container = useLoaderData();
|
||||
const revalidator = useRevalidator();
|
||||
const [isPowerStateLocked, setPowerStateLocked] = useState<boolean>();
|
||||
|
||||
if (!container.data) {
|
||||
return "Container not found";
|
||||
}
|
||||
|
||||
container = container.data as InfoData;
|
||||
|
||||
const revalidator = useRevalidator();
|
||||
const [isPowerStateLocked, setPowerStateLocked] = useState<boolean>();
|
||||
|
||||
return (
|
||||
<Paper square sx={{ padding: 1 }}>
|
||||
<Paper sx={{ display: "flex" }} variant="outlined">
|
||||
|
@ -1,32 +1,25 @@
|
||||
import { useLoaderData } from "react-router";
|
||||
import { Container } from "../../types";
|
||||
import { InfoData } from "../../types";
|
||||
import { Paper, Typography } from "@mui/material";
|
||||
import WebTerminal from "../../components/WebTerminal";
|
||||
|
||||
export async function Loader() {
|
||||
const info = await fetch(`https://api.ssh.surf/info`, {
|
||||
headers: { "x-ssh-auth": localStorage["key"] },
|
||||
});
|
||||
|
||||
const data = await info.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
export default function TerminalPage() {
|
||||
const container = useLoaderData() as Container & { statusCode: number };
|
||||
let container = useLoaderData();
|
||||
|
||||
if (container.statusCode === 404) {
|
||||
return "Container not found";
|
||||
}
|
||||
if (!container.data) {
|
||||
return "Container not found";
|
||||
}
|
||||
|
||||
return (
|
||||
<Paper square sx={{ padding: 1 }}>
|
||||
<Paper sx={{ display: "flex" }} variant="outlined">
|
||||
<Typography variant="h6" sx={{ flexGrow: 1 }}>
|
||||
Terminal: {container.name}
|
||||
</Typography>
|
||||
</Paper>
|
||||
<WebTerminal />
|
||||
</Paper>
|
||||
);
|
||||
container = container.data as InfoData;
|
||||
|
||||
return (
|
||||
<Paper square sx={{ padding: 1 }}>
|
||||
<Paper sx={{ display: "flex" }} variant="outlined">
|
||||
<Typography variant="h6" sx={{ flexGrow: 1 }}>
|
||||
Terminal: {container.name}
|
||||
</Typography>
|
||||
</Paper>
|
||||
<WebTerminal />
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user