move build to cmd
This commit is contained in:
parent
734cf55122
commit
14f06a4ddb
|
@ -7,22 +7,26 @@ import Table from "../components/Table";
|
|||
import authServerSideProps from "../services/authServerSideProps";
|
||||
import { SkynetClient } from "skynet-js";
|
||||
|
||||
const skynetClient = new SkynetClient(process.env.SKYNET_PORTAL_API);
|
||||
const apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
|
||||
const fetcher = (url) => fetch(url).then((r) => r.json());
|
||||
const getSkylinkLink = ({ skylink }) => skynetClient.getSkylinkUrl(skylink);
|
||||
const getRelativeDate = ({ uploadedOn }) => dayjs(uploadedOn).format("YYYY-MM-DD HH:mm:ss");
|
||||
const headers = [
|
||||
|
||||
export const getServerSideProps = authServerSideProps();
|
||||
export const getStaticProps = () => {
|
||||
const skynetClient = new SkynetClient(process.env.SKYNET_PORTAL_API);
|
||||
const getSkylinkLink = ({ skylink }) => skynetClient.getSkylinkUrl(skylink);
|
||||
const getRelativeDate = ({ uploadedOn }) => dayjs(uploadedOn).format("YYYY-MM-DD HH:mm:ss");
|
||||
const headers = [
|
||||
{ key: "name", name: "Name", nowrap: false, href: getSkylinkLink },
|
||||
{ key: "skylink", name: "Skylink" },
|
||||
{ key: "size", name: "Size", formatter: ({ size }) => prettyBytes(size) },
|
||||
{ key: "uploadedOn", name: "Uploaded on", formatter: getRelativeDate },
|
||||
];
|
||||
const actions = [];
|
||||
];
|
||||
const actions = [];
|
||||
|
||||
export const getServerSideProps = authServerSideProps();
|
||||
return { props: { headers, actions } };
|
||||
};
|
||||
|
||||
export default function Uploads() {
|
||||
export default function Uploads({ headers, actions }) {
|
||||
const [offset, setOffset] = useState(0);
|
||||
const { data, error } = useSWR(`${apiPrefix}/user/uploads?pageSize=10&offset=${offset}`, fetcher);
|
||||
|
||||
|
|
Reference in New Issue