diff --git a/packages/dashboard-v2/gatsby-config.js b/packages/dashboard-v2/gatsby-config.js index b742e91b..017a4dfc 100644 --- a/packages/dashboard-v2/gatsby-config.js +++ b/packages/dashboard-v2/gatsby-config.js @@ -1,3 +1,5 @@ +const { createProxyMiddleware } = require("http-proxy-middleware"); + module.exports = { siteMetadata: { title: `Accounts Dashboard`, @@ -20,4 +22,14 @@ module.exports = { __key: "images", }, ], + developMiddleware: (app) => { + app.use( + "/api/", + createProxyMiddleware({ + target: "https://account.siasky.net", + secure: false, // Do not reject self-signed certificates. + changeOrigin: true, + }) + ); + }, }; diff --git a/packages/dashboard-v2/package.json b/packages/dashboard-v2/package.json index 8d088e7c..c94cfa3f 100644 --- a/packages/dashboard-v2/package.json +++ b/packages/dashboard-v2/package.json @@ -23,12 +23,14 @@ "@fontsource/source-sans-pro": "^4.5.3", "gatsby": "^4.6.2", "gatsby-plugin-postcss": "^5.7.0", + "http-status-codes": "^2.2.0", "postcss": "^8.4.6", "pretty-bytes": "^6.0.0", "react": "^17.0.1", "react-dom": "^17.0.1", "react-helmet": "^6.1.0", "react-use": "^17.3.2", + "swr": "^1.2.2", "tailwindcss": "^3.0.23" }, "devDependencies": { @@ -59,6 +61,7 @@ "gatsby-plugin-styled-components": "^5.8.0", "gatsby-source-filesystem": "^4.6.0", "gatsby-transformer-sharp": "^4.6.0", + "http-proxy-middleware": "^1.3.1", "prettier": "2.5.1", "react-is": "^17.0.2", "storybook-addon-gatsby": "^0.0.5", diff --git a/packages/dashboard-v2/src/layouts/DashboardLayout.js b/packages/dashboard-v2/src/layouts/DashboardLayout.js index bfd23c42..32156549 100644 --- a/packages/dashboard-v2/src/layouts/DashboardLayout.js +++ b/packages/dashboard-v2/src/layouts/DashboardLayout.js @@ -1,5 +1,8 @@ import * as React from "react"; import styled from "styled-components"; +import { SWRConfig } from "swr"; + +import { authenticatedOnly } from "../lib/swrConfig"; import { PageContainer } from "../components/PageContainer"; import { NavBar } from "../components/Navbar"; @@ -16,13 +19,15 @@ const Layout = styled.div.attrs({ const DashboardLayout = ({ children }) => { return ( <> - - - -
{children}
-
-