fix: use hostname for suspense query url (#2187)
This commit is contained in:
1 parent
bd0b7c9518
commit
96fd5cc35e
5 files changed
+22
-19
No files matched your search
@@ -36,3 +36,18 @@ async function importCookiesAsync() {
|
||||
.map(({ name, value }) => `${name}=${value}`)
|
||||
.join(";");
|
||||
}
|
||||
|
||||
function getBaseUrl() {
|
||||
if (typeof window !== "undefined") return window.location.origin;
|
||||
return `http://${process.env.HOSTNAME ?? "localhost"}:3000`;
|
||||
}
|
||||
|
||||
export const trpcPath = "/api/trpc";
|
||||
|
||||
/**
|
||||
* Creates the full url for the trpc api endpoint
|
||||
* @returns
|
||||
*/
|
||||
export function getTrpcUrl() {
|
||||
return `${getBaseUrl()}${trpcPath}`;
|
||||
}
|
||||
Reference in new issue
Block a user