move build to cmd
This commit is contained in:
parent
20876562a6
commit
00e383e1ba
|
@ -13,4 +13,4 @@ COPY styles ./styles
|
||||||
COPY postcss.config.js .
|
COPY postcss.config.js .
|
||||||
COPY tailwind.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"]
|
||||||
|
|
|
@ -7,7 +7,7 @@ import Table from "../components/Table";
|
||||||
import authServerSideProps from "../services/authServerSideProps";
|
import authServerSideProps from "../services/authServerSideProps";
|
||||||
import { SkynetClient } from "skynet-js";
|
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 apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
|
||||||
const fetcher = (url) => fetch(url).then((r) => r.json());
|
const fetcher = (url) => fetch(url).then((r) => r.json());
|
||||||
const getSkylinkLink = ({ skylink }) => skynetClient.getSkylinkUrl(skylink);
|
const getSkylinkLink = ({ skylink }) => skynetClient.getSkylinkUrl(skylink);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { SkynetClient } from "skynet-js";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
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 apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
|
||||||
const fetcher = (url) => fetch(url).then((r) => r.json());
|
const fetcher = (url) => fetch(url).then((r) => r.json());
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,22 @@ import Table from "../components/Table";
|
||||||
import authServerSideProps from "../services/authServerSideProps";
|
import authServerSideProps from "../services/authServerSideProps";
|
||||||
import { SkynetClient } from "skynet-js";
|
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 apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
|
||||||
const fetcher = (url) => fetch(url).then((r) => r.json());
|
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 = [
|
||||||
|
{ 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 = [];
|
||||||
|
|
||||||
export const getServerSideProps = authServerSideProps(() => {
|
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 = [
|
|
||||||
{ 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 = [];
|
|
||||||
|
|
||||||
return { props: { headers, actions } };
|
export default function Uploads() {
|
||||||
});
|
|
||||||
|
|
||||||
export default function Uploads({ headers, actions }) {
|
|
||||||
const [offset, setOffset] = useState(0);
|
const [offset, setOffset] = useState(0);
|
||||||
const { data, error } = useSWR(`${apiPrefix}/user/uploads?pageSize=10&offset=${offset}`, fetcher);
|
const { data, error } = useSWR(`${apiPrefix}/user/uploads?pageSize=10&offset=${offset}`, fetcher);
|
||||||
|
|
||||||
|
|
Reference in New Issue