Rewrite web front-end using React

This is a big commit, some font-end function are still working,
including manage, error handle, as others.
This commit is contained in:
2021-11-21 17:30:43 +08:00
parent d556bbe0c8
commit e170c8b842
38 changed files with 38580 additions and 19880 deletions

View File

@@ -0,0 +1,32 @@
import { useEffect, useState } from "react";
import { useParams } from "react-router";
import FilesTable from "./FilesTable";
function Share(props) {
let params = useParams();
const [file, setFile] = useState([]);
useEffect(() => {
fetch("/api/v1/get_file_info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
id: parseInt(params.id),
}),
})
.then((response) => response.json())
.then((data) => {
setFile([data]);
});
}, [params]);
return (
<div className="page">
<h3>Share with others! {params.id}</h3>
<p>
Share link: <a href={window.location.href}>{window.location.href}</a>
</p>
<FilesTable setPlayingFile={props.setPlayingFile} files={file} />
</div>
);
}
export default Share;