mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-13 08:01:50 +02:00
♻️ Avoid getServerSideProps for login/register (#755)
This commit is contained in:
parent
becc7a7930
commit
438c4ec35b
12 changed files with 98 additions and 197 deletions
|
@ -6,17 +6,25 @@ const getVercelUrl = () => {
|
|||
: null;
|
||||
};
|
||||
|
||||
function joinPath(baseUrl: string, subpath = "") {
|
||||
if (subpath) {
|
||||
const url = new URL(subpath, baseUrl);
|
||||
return url.href;
|
||||
}
|
||||
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
export function absoluteUrl(subpath = "") {
|
||||
const baseUrl =
|
||||
process.env.NEXT_PUBLIC_BASE_URL ??
|
||||
getVercelUrl() ??
|
||||
`http://localhost:${port}`;
|
||||
const url = new URL(subpath, baseUrl);
|
||||
return url.href;
|
||||
|
||||
return joinPath(baseUrl, subpath);
|
||||
}
|
||||
|
||||
export function shortUrl(subpath = "") {
|
||||
const baseUrl = process.env.NEXT_PUBLIC_SHORT_BASE_URL ?? absoluteUrl();
|
||||
const url = new URL(subpath, baseUrl);
|
||||
return url.href;
|
||||
return joinPath(baseUrl, subpath);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue