Skip to content

Commit

Permalink
Fix bug where relative urls didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKnarf committed Apr 28, 2021
1 parent b2a4699 commit 5c0e7d9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react';
import { GetServerSideProps } from 'next'
import MDX from '@mdx-js/runtime';
import App from '../components/app';
import App, { AppProps as IApp } from '../components/app';
import Grid from '../components/grid';
import useForceHttps, { ForceHttpsStatus, replaceUrlWithHttps } from '../force-https';
import { getContainersWithLabels, AppProps } from '../docker';
Expand Down Expand Up @@ -51,13 +51,15 @@ const Style : React.FC<{ colors : Colors }> = ({ colors }) => {

const Home : React.FC<Props> = ({ colors, mdx, appData, forceHttps }) => {
const httpStatus = useForceHttps(forceHttps);
const apps = useMemo(() => {
return (appData||[]).map(({
let apps : IApp[] = [];

if(typeof window !== 'undefined') {
apps = (appData||[]).map(({
relativeSubdomain,
url,
...app
}) => {
const href = (relativeSubdomain && typeof window !== 'undefined')
const href = relativeSubdomain
? `//${relativeSubdomain}.${window.location.host}/`
: (url || "");

Expand All @@ -67,7 +69,7 @@ const Home : React.FC<Props> = ({ colors, mdx, appData, forceHttps }) => {

return { ...app, href };
});
}, [appData, httpStatus]);
}

return <>
<Style colors={colors} />
Expand Down

0 comments on commit 5c0e7d9

Please sign in to comment.