Revert changes to absolute-url (#194)

This commit is contained in:
Luke Vella 2022-06-01 11:05:00 +01:00 committed by GitHub
parent 4ce5a1990e
commit f666702527
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,13 @@
export function absoluteUrl() {
return process.env.NEXT_PUBLIC_BASE_URL ?? process.env.NEXT_PUBLIC_VERCEL_URL
const getVercelUrl = () => {
return process.env.NEXT_PUBLIC_VERCEL_URL
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
: typeof window !== "undefined"
? window.origin
: "http://localhost:3000";
: null;
};
export function absoluteUrl() {
return (
process.env.NEXT_PUBLIC_BASE_URL ??
getVercelUrl() ??
"http://localhost:3000"
);
}