maybe fix?
This commit is contained in:
parent
ffdf91baf6
commit
635fa9d5c5
1 changed files with 12 additions and 4 deletions
|
@ -551,10 +551,18 @@ const sidebarItemVariants: Variants = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
UserPage.getInitialProps = async (context: { query: { username: string } }) => {
|
UserPage.getInitialProps = async (context: {
|
||||||
const res = await fetch(
|
query: { username: string };
|
||||||
`${process.env.NEXT_PUBLIC_URL}/api/fakeUsers?u=${context.query.username}`
|
req: any;
|
||||||
);
|
}) => {
|
||||||
|
let host = process.env.NEXT_PUBLIC_URL;
|
||||||
|
console.log(host);
|
||||||
|
if (context.req) {
|
||||||
|
// 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);
|
||||||
let user = await res.json();
|
let user = await res.json();
|
||||||
if (user.error) {
|
if (user.error) {
|
||||||
user = { data: user };
|
user = { data: user };
|
||||||
|
|
Loading…
Add table
Reference in a new issue