move build to cmd

This commit is contained in:
Karol Wypchlo 2021-02-20 17:06:21 +01:00
parent 734cf55122
commit 14f06a4ddb
1 changed files with 15 additions and 11 deletions

View File

@ -7,9 +7,12 @@ 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());
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 = [
@ -20,9 +23,10 @@ const headers = [
];
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);