Correctly route passport API calls to the main domain
Fix API base URL and endpoint paths for passport subdomain data fetching. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 8603519b-b8fc-4ba4-8d57-1fa6e0af6afc Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/saoW2ee Replit-Helium-Checkpoint-Created: true
This commit is contained in:
commit
ddcbab0127
2 changed files with 14 additions and 4 deletions
4
.replit
4
.replit
|
|
@ -52,6 +52,10 @@ externalPort = 80
|
|||
localPort = 8044
|
||||
externalPort = 3003
|
||||
|
||||
[[ports]]
|
||||
localPort = 33171
|
||||
externalPort = 3002
|
||||
|
||||
[[ports]]
|
||||
localPort = 38557
|
||||
externalPort = 3000
|
||||
|
|
|
|||
|
|
@ -10,8 +10,14 @@ import FourOhFourPage from "@/pages/404";
|
|||
import Index from "@/pages/Index";
|
||||
import type { AethexUserProfile } from "@/lib/aethex-database-adapter";
|
||||
|
||||
const getApiBase = () =>
|
||||
typeof window !== "undefined" ? window.location.origin : "";
|
||||
const getApiBase = () => {
|
||||
if (typeof window === "undefined") return "";
|
||||
const hostname = window.location.hostname;
|
||||
if (hostname.includes("aethex.me") || hostname.includes("aethex.space")) {
|
||||
return "https://aethex.dev";
|
||||
}
|
||||
return window.location.origin;
|
||||
};
|
||||
|
||||
interface CreatorPassportResponse {
|
||||
type: "creator";
|
||||
|
|
@ -115,11 +121,11 @@ const SubdomainPassport = () => {
|
|||
|
||||
let url = "";
|
||||
if (subdomainInfo.isCreatorPassport) {
|
||||
url = `${apiBase}/api/passport/subdomain-data/${encodeURIComponent(
|
||||
url = `${apiBase}/api/passport/subdomain/${encodeURIComponent(
|
||||
subdomainInfo.subdomain,
|
||||
)}`;
|
||||
} else if (subdomainInfo.isProjectPassport) {
|
||||
url = `${apiBase}/api/passport/project-data/${encodeURIComponent(
|
||||
url = `${apiBase}/api/passport/project/${encodeURIComponent(
|
||||
subdomainInfo.subdomain,
|
||||
)}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue