move build to cmd

This commit is contained in:
Karol Wypchlo 2021-02-20 17:15:32 +01:00
parent 20876562a6
commit 00e383e1ba
4 changed files with 15 additions and 18 deletions

View File

@ -13,4 +13,4 @@ COPY styles ./styles
COPY postcss.config.js .
COPY tailwind.config.js .
CMD ["sh", "-c", "yarn build && yarn start"]
CMD ["sh", "-c", "env | grep NEXT_PUBLIC_ > .env.local && yarn build && yarn start"]

View File

@ -7,7 +7,7 @@ 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 skynetClient = new SkynetClient(process.env.NEXT_PUBLIC_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);

View File

@ -9,7 +9,7 @@ import { SkynetClient } from "skynet-js";
dayjs.extend(relativeTime);
const skynetClient = new SkynetClient(process.env.SKYNET_PORTAL_API);
const skynetClient = new SkynetClient(process.env.NEXT_PUBLIC_SKYNET_PORTAL_API);
const apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
const fetcher = (url) => fetch(url).then((r) => r.json());

View File

@ -7,25 +7,22 @@ import Table from "../components/Table";
import authServerSideProps from "../services/authServerSideProps";
import { SkynetClient } from "skynet-js";
const skynetClient = new SkynetClient(process.env.NEXT_PUBLIC_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(() => {
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 = [
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 = [];
return { props: { headers, actions } };
});
export const getServerSideProps = authServerSideProps();
export default function Uploads({ headers, actions }) {
export default function Uploads() {
const [offset, setOffset] = useState(0);
const { data, error } = useSWR(`${apiPrefix}/user/uploads?pageSize=10&offset=${offset}`, fetcher);