authenticate downloads and uploads routes

This commit is contained in:
Karol Wypchlo 2021-02-19 16:56:22 +01:00
parent 5472833369
commit aeba920da5
2 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import { useState } from "react";
import useSWR from "swr";
import Layout from "../components/Layout";
import Table from "../components/Table";
import authServerSideProps from "../services/authServerSideProps";
const apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
const fetcher = (url) => fetch(url).then((r) => r.json());
@ -15,6 +16,8 @@ const headers = [
];
const actions = [];
export const getServerSideProps = authServerSideProps();
export default function Downloads() {
const [offset, setOffset] = useState(0);
const { data, error } = useSWR(`${apiPrefix}/user/downloads?pageSize=10&offset=${offset}`, fetcher);

View File

@ -4,6 +4,7 @@ import { useState } from "react";
import useSWR from "swr";
import Layout from "../components/Layout";
import Table from "../components/Table";
import authServerSideProps from "../services/authServerSideProps";
const apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : "";
const fetcher = (url) => fetch(url).then((r) => r.json());
@ -15,6 +16,8 @@ const headers = [
];
const actions = [];
export const getServerSideProps = authServerSideProps();
export default function Uploads() {
const [offset, setOffset] = useState(0);
const { data, error } = useSWR(`${apiPrefix}/user/uploads?pageSize=10&offset=${offset}`, fetcher);