nope, fix tmrw

This commit is contained in:
3zachm 2023-01-26 03:00:10 -08:00
parent 635fa9d5c5
commit 8bb4053990

View file

@ -555,13 +555,10 @@ UserPage.getInitialProps = async (context: {
query: { username: string }; query: { username: string };
req: any; req: any;
}) => { }) => {
let host = process.env.NEXT_PUBLIC_URL; // fix weird bug where host env was undefined on layout render, not direct page render
console.log(host); const url = new URL(
if (context.req) { `https://invest.3zachm.dev/api/fakeUsers?u=${context.query.username}`
// if env breaks ??? );
let host = context.req.headers.host;
}
const url = new URL(`${host}/api/fakeUsers?u=${context.query.username}`);
const res = await fetch(url); const res = await fetch(url);
let user = await res.json(); let user = await res.json();
if (user.error) { if (user.error) {