From aeba920da530ee765b0b801497936e5628655b3e Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 19 Feb 2021 16:56:22 +0100 Subject: [PATCH] authenticate downloads and uploads routes --- packages/dashboard/src/pages/downloads.js | 3 +++ packages/dashboard/src/pages/uploads.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/dashboard/src/pages/downloads.js b/packages/dashboard/src/pages/downloads.js index 92f162ce..a3b4cae1 100644 --- a/packages/dashboard/src/pages/downloads.js +++ b/packages/dashboard/src/pages/downloads.js @@ -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); diff --git a/packages/dashboard/src/pages/uploads.js b/packages/dashboard/src/pages/uploads.js index 2bd7193f..c85cb857 100644 --- a/packages/dashboard/src/pages/uploads.js +++ b/packages/dashboard/src/pages/uploads.js @@ -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);