authenticate downloads and uploads routes
This commit is contained in:
parent
5472833369
commit
aeba920da5
|
@ -4,6 +4,7 @@ import { useState } from "react";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import Layout from "../components/Layout";
|
import Layout from "../components/Layout";
|
||||||
import Table from "../components/Table";
|
import Table from "../components/Table";
|
||||||
|
import authServerSideProps from "../services/authServerSideProps";
|
||||||
|
|
||||||
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());
|
||||||
|
@ -15,6 +16,8 @@ const headers = [
|
||||||
];
|
];
|
||||||
const actions = [];
|
const actions = [];
|
||||||
|
|
||||||
|
export const getServerSideProps = authServerSideProps();
|
||||||
|
|
||||||
export default function Downloads() {
|
export default function Downloads() {
|
||||||
const [offset, setOffset] = useState(0);
|
const [offset, setOffset] = useState(0);
|
||||||
const { data, error } = useSWR(`${apiPrefix}/user/downloads?pageSize=10&offset=${offset}`, fetcher);
|
const { data, error } = useSWR(`${apiPrefix}/user/downloads?pageSize=10&offset=${offset}`, fetcher);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useState } from "react";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import Layout from "../components/Layout";
|
import Layout from "../components/Layout";
|
||||||
import Table from "../components/Table";
|
import Table from "../components/Table";
|
||||||
|
import authServerSideProps from "../services/authServerSideProps";
|
||||||
|
|
||||||
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());
|
||||||
|
@ -15,6 +16,8 @@ const headers = [
|
||||||
];
|
];
|
||||||
const actions = [];
|
const actions = [];
|
||||||
|
|
||||||
|
export const getServerSideProps = authServerSideProps();
|
||||||
|
|
||||||
export default function Uploads() {
|
export default function Uploads() {
|
||||||
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