chore: basepath fixes

This commit is contained in:
AP 2020-04-14 23:02:33 +02:00
parent 8c8291f527
commit 758281b7bc
6 changed files with 63 additions and 35 deletions

View File

@ -1,11 +1,13 @@
import { ApolloClient, InMemoryCache, HttpLink } from 'apollo-boost';
import fetch from 'isomorphic-unfetch';
import withApollo from 'next-with-apollo';
import getConfig from 'next/config';
const GRAPHQL_URL = '/api/v1';
const { publicRuntimeConfig } = getConfig();
const { apiUrl } = publicRuntimeConfig;
const link = new HttpLink({
uri: GRAPHQL_URL,
uri: apiUrl,
credentials: 'same-origin',
fetch,
});

View File

@ -13,6 +13,7 @@ module.exports = withBundleAnalyzer({
},
publicRuntimeConfig: {
nodeEnv: process.env.NODE_ENV || 'development',
apiUrl: `${process.env.BASE_PATH || ''}/api/v1`,
basePath: process.env.BASE_PATH || '',
npmVersion: process.env.npm_package_version || '0.0.0',
},

View File

@ -22,7 +22,6 @@ import {
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import '../src/styles/FontStyles.css';
import Head from 'next/head';
toast.configure({ draggable: false });
@ -66,28 +65,13 @@ class MyApp extends App<any> {
render() {
const { Component, pageProps, apollo } = this.props;
return (
<>
<Head>
<title>ThunderHub - Lightning Node Manager</title>
<meta
name="viewport"
content="initial-scale=1.0, width=device-width"
key="viewport"
/>
<meta
name="description"
content="Manage and monitor your lightning network node right inside your browser"
key="description"
/>
</Head>
<ApolloProvider client={apollo}>
<ContextProvider>
<Wrapper>
<Component {...pageProps} />
</Wrapper>
</ContextProvider>
</ApolloProvider>
</>
<ApolloProvider client={apollo}>
<ContextProvider>
<Wrapper>
<Component {...pageProps} />
</Wrapper>
</ContextProvider>
</ApolloProvider>
);
}
}

View File

@ -1,8 +1,14 @@
import Document from 'next/document';
import Document, {
DocumentContext,
Html,
Head,
Main,
NextScript,
} from 'next/document';
import { ServerStyleSheet } from 'styled-components';
export default class MyDocument extends Document {
static async getInitialProps(ctx) {
static async getInitialProps(ctx: DocumentContext) {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;
@ -26,4 +32,28 @@ export default class MyDocument extends Document {
sheet.seal();
}
}
render() {
return (
<Html>
<Head>
<title>ThunderHub - Lightning Node Manager</title>
<meta
name="viewport"
content="initial-scale=1.0, width=device-width"
key="viewport"
/>
<meta
name="description"
content="Manage and monitor your lightning network node right inside your browser"
key="description"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

View File

@ -1,8 +1,12 @@
import { ApolloServer } from 'apollo-server-micro';
import { thunderHubSchema } from '../../src/api/schemas';
import { getIp } from '../../src/api/helpers/helpers';
import getConfig from 'next/config';
import Cors from 'micro-cors';
const { publicRuntimeConfig } = getConfig();
const { apiUrl } = publicRuntimeConfig;
const cors = Cors({
origin: true,
});
@ -15,7 +19,7 @@ const apolloServer = new ApolloServer({
},
});
const handler = apolloServer.createHandler({ path: '/api/v1' });
const handler = apolloServer.createHandler({ path: apiUrl });
export const config = {
api: {

View File

@ -2,47 +2,54 @@
font-family: 'Manrope';
font-style: normal;
font-weight: 900;
src: url('../../public/fonts/Manrope-ExtraBold.otf') format('opentype');
font-display: swap;
src: url('/fonts/Manrope-ExtraBold.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 700;
src: url('../../public/fonts//Manrope-Bold.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-Bold.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 600;
src: url('../../public/fonts//Manrope-SemiBold.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-SemiBold.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 500;
src: url('../../public/fonts//Manrope-Medium.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-Medium.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 400;
src: url('../../public/fonts//Manrope-Regular.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-Regular.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 200;
src: url('../../public/fonts//Manrope-Light.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-Light.otf') format('opentype');
}
@font-face {
font-family: 'Manrope';
font-style: normal;
font-weight: 100;
src: url('../../public/fonts//Manrope-ExtraLight.otf') format('opentype');
font-display: swap;
src: url('/fonts//Manrope-ExtraLight.otf') format('opentype');
}