fix: route client /api/* through /api/gateway/* proxy\n\nLogin, signup, forgot-password, dashboard, contact, help-center, and all dashboard component fetches were calling bare /api/* paths. The SolidStart server has no /api/auth/*, /api/support/*, or /api/kb/* handlers -- only /api/gateway/[...path] proxies to the Rust gateway. So those calls returned HTML (SPA catch-all), the JSON parse threw silently, and the buttons looked dead. Sign In / Sign Up / Forgot Password all appeared to be no-ops.\n\nThis routes every client-side fetch through the existing gateway proxy, matching the pattern already used by src/lib/api.ts.\n\nAlso fixes hardcoded test121 -> test111 in canonical/og:url tags across index, professionals, help-center, and RoleLandingPage.

This commit is contained in:
Ashwin Kumar Sivakumar 2026-06-11 14:10:10 +05:30
parent 31101db955
commit aabfacc735
15 changed files with 31 additions and 31 deletions

View file

@ -98,7 +98,7 @@ export default function DashboardLayout(props: ParentProps) {
const token = sessionStorage.getItem("nxtgauge_access_token");
if (token) {
try {
const res = await fetch("/api/auth/session", {
const res = await fetch("/api/gateway/auth/session", {
headers: {
Accept: "application/json",
Authorization: `Bearer ${token}`,

View file

@ -115,7 +115,7 @@ export default function RoleLandingPage(props: Props) {
return item;
});
const canonical = createMemo(() => `https://test121.nxtgauge.com${props.pathBase}/${encodeURIComponent(String(props.slug || ''))}`);
const canonical = createMemo(() => `https://test111.nxtgauge.com${props.pathBase}/${encodeURIComponent(String(props.slug || ''))}`);
const pageTitle = createMemo(() => (content() ? `${content()!.shortTitle} | Nxtgauge` : 'Role | Nxtgauge'));
const pageDescription = createMemo(() =>
content() ? `${content()!.heroDescription} Most role reviews complete in 24-48 hours.` : 'Role landing page on Nxtgauge.'

View file

@ -1054,7 +1054,7 @@ export default function DashboardDesignPreview(props: {
try {
const token = getToken();
if (!token) return;
const res = await fetch('/api/me/notifications/unread-count', {
const res = await fetch('/api/gateway/me/notifications/unread-count', {
headers: { Authorization: `Bearer ${token}` },
credentials: 'include',
});

View file

@ -267,14 +267,14 @@ export default function MyDashboardPage(props: Props) {
try {
if (roleKey === 'COMPANY') {
const [jobsRes, appsRes] = await Promise.all([
fetch('/api/companies/jobs?page=1&limit=100', {
fetch('/api/gateway/companies/jobs?page=1&limit=100', {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${window.sessionStorage.getItem('nxtgauge_access_token') || ''}`,
},
}),
fetch('/api/companies/jobs?page=1&limit=1', {
fetch('/api/gateway/companies/jobs?page=1&limit=1', {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
@ -293,7 +293,7 @@ export default function MyDashboardPage(props: Props) {
);
if (!jobsRes.ok && !appsRes.ok) setErr('Some company metrics could not be loaded.');
} else if (roleKey === 'CUSTOMER') {
const res = await fetch('/api/customers/requirements?page=1&limit=100', {
const res = await fetch('/api/gateway/customers/requirements?page=1&limit=100', {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
@ -311,14 +311,14 @@ export default function MyDashboardPage(props: Props) {
if (!res.ok) setErr('Some customer metrics could not be loaded.');
} else if (roleKey === 'JOB_SEEKER') {
const [jobsRes, appsRes] = await Promise.all([
fetch('/api/jobseeker/jobs?page=1&limit=100', {
fetch('/api/gateway/jobseeker/jobs?page=1&limit=100', {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${window.sessionStorage.getItem('nxtgauge_access_token') || ''}`,
},
}),
fetch('/api/jobseeker/applications?page=1&limit=100', {
fetch('/api/gateway/jobseeker/applications?page=1&limit=100', {
credentials: 'include',
headers: {
'Content-Type': 'application/json',

View file

@ -82,7 +82,7 @@ async function fetchSession(): Promise<AuthUser | null> {
const token = getToken();
if (!token) return null;
try {
const res = await fetch("/api/auth/session", {
const res = await fetch("/api/gateway/auth/session", {
headers: {
Accept: 'application/json',
Authorization: `Bearer ${token}`,

View file

@ -42,7 +42,7 @@ export async function fetchHelpCenterArticles(input: {
// Fallback: when backend search returns sparse/empty data, apply local filtering
// so users can still find articles by simple keywords.
if (input.q && items.length === 0) {
const allRes = await fetch("/api/kb/articles");
const allRes = await fetch("/api/gateway/kb/articles");
if (allRes.ok) {
const allData = await allRes.json();
const allRaw: any[] = Array.isArray(allData) ? allData : (allData.articles ?? []);
@ -62,7 +62,7 @@ export async function fetchHelpCenterArticles(input: {
export async function fetchHelpCenterCategories(): Promise<HelpCategory[]> {
try {
const res = await fetch("/api/kb/categories");
const res = await fetch("/api/gateway/kb/categories");
if (!res.ok) return HELP_CENTER_SEED_CATEGORIES;
const data = await res.json();
const raw: any[] = Array.isArray(data) ? data : (data.categories ?? []);
@ -98,7 +98,7 @@ export async function fetchRelatedArticles(input: {
limit?: number;
}): Promise<HelpArticle[]> {
try {
const res = await fetch("/api/kb/articles");
const res = await fetch("/api/gateway/kb/articles");
if (!res.ok)
return pickRelated(
HELP_CENTER_SEED_ARTICLES as HelpArticle[],

View file

@ -158,7 +158,7 @@ export default function ContactPage() {
"Job Seeker (Apply jobs)": "GENERAL",
};
const category = userTypeToCategory[values().userType] || "GENERAL";
const res = await fetch("/api/support/tickets", {
const res = await fetch("/api/gateway/support/tickets", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",

View file

@ -648,7 +648,7 @@ export default function RuntimeDashboardPage() {
const email = authEmail || getEmailFromStorage();
if (!email) return;
const checkRes = await fetch("/api/auth/check-email", {
const checkRes = await fetch("/api/gateway/auth/check-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -671,7 +671,7 @@ export default function RuntimeDashboardPage() {
const token = getToken();
if (token) {
const switchRes = await fetch("/api/auth/switch-role", {
const switchRes = await fetch("/api/gateway/auth/switch-role", {
method: "POST",
headers: {
"Content-Type": "application/json",

View file

@ -48,7 +48,7 @@ export default function ForgotPasswordRoute() {
}
setSubmitting(true);
try {
const res = await fetch('/api/auth/forgot-password', {
const res = await fetch('/api/gateway/auth/forgot-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: email().trim().toLowerCase() }),
@ -82,7 +82,7 @@ export default function ForgotPasswordRoute() {
}
setSubmitting(true);
try {
const res = await fetch('/api/auth/reset-password', {
const res = await fetch('/api/gateway/auth/reset-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({

View file

@ -26,7 +26,7 @@ export default function HelpCenterArticlePage() {
(item) => (item ? fetchRelatedArticles({ article: item, limit: 4 }) : [])
);
const canonical = createMemo(
() => `https://test121.nxtgauge.com/help-center/article/${encodeURIComponent(slug())}`
() => `https://test111.nxtgauge.com/help-center/article/${encodeURIComponent(slug())}`
);
const pageTitle = createMemo(() => {
const a = article();

View file

@ -10,7 +10,7 @@ export default function HelpCenterPage() {
const title = "Help Center | Nxtgauge";
const description =
"Browse Nxtgauge guides for getting started, roles, requests, approvals, and platform troubleshooting.";
const canonical = "https://test121.nxtgauge.com/help-center";
const canonical = "https://test111.nxtgauge.com/help-center";
const [query, setQuery] = createSignal("");
const [category, setCategory] = createSignal("");

View file

@ -4,7 +4,7 @@ import PublicLanding from '~/components/PublicLanding';
export default function Home() {
const title = 'Nxtgauge | Verified Jobs & Professional Services Platform';
const description = 'Trusted hiring and opportunity discovery for customers, companies, professionals, and job seekers with verification built in.';
const canonical = 'https://test121.nxtgauge.com/';
const canonical = 'https://test111.nxtgauge.com/';
return (
<>

View file

@ -133,7 +133,7 @@ export default function LoginRoute() {
}
setCheckingRole(true);
try {
const response = await fetch("/api/auth/check-email", {
const response = await fetch("/api/gateway/auth/check-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -243,7 +243,7 @@ export default function LoginRoute() {
}
setSubmitting(true);
try {
const res = await fetch("/api/auth/login", {
const res = await fetch("/api/gateway/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -283,7 +283,7 @@ export default function LoginRoute() {
if (discoveredRoleKeys.length === 0 || isJobSeekerRole(discoveredActiveRole)) {
try {
const checkRes = await fetch("/api/auth/check-email", {
const checkRes = await fetch("/api/gateway/auth/check-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -324,7 +324,7 @@ export default function LoginRoute() {
let desiredRoleKey = discoveredActiveRole;
if (finalAccessToken && requestedRoleKey && requestedRoleKey !== discoveredActiveRole) {
try {
const switchRes = await fetch("/api/auth/switch-role", {
const switchRes = await fetch("/api/gateway/auth/switch-role", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -385,7 +385,7 @@ export default function LoginRoute() {
setError("");
setSubmitting(true);
try {
const res = await fetch("/api/auth/resend-otp", {
const res = await fetch("/api/gateway/auth/resend-otp", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -409,7 +409,7 @@ export default function LoginRoute() {
}
setSubmitting(true);
try {
const verifyRes = await fetch("/api/auth/verify-email", {
const verifyRes = await fetch("/api/gateway/auth/verify-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",

View file

@ -17,7 +17,7 @@ const chipNodes = [
export default function ProfessionalsIndexPage() {
const [scrollY, setScrollY] = createSignal(0);
const [reduceMotion, setReduceMotion] = createSignal(false);
const canonical = 'https://test121.nxtgauge.com/professionals';
const canonical = 'https://test111.nxtgauge.com/professionals';
const title = 'Professionals | Nxtgauge Verified Service Categories';
const description = 'Explore verified professional categories on Nxtgauge and register with a trust-first workflow built for better opportunity quality.';

View file

@ -133,7 +133,7 @@ export default function SignupRoute() {
}
try {
const response = await fetch("/api/auth/check-email", {
const response = await fetch("/api/gateway/auth/check-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -218,7 +218,7 @@ export default function SignupRoute() {
setSubmitting(true);
try {
console.log('[register] after canSubmit guard, calling API...');
const res = await fetch("/api/auth/register", {
const res = await fetch("/api/gateway/auth/register", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -311,7 +311,7 @@ export default function SignupRoute() {
}
setSubmitting(true);
try {
const verifyRes = await fetch("/api/auth/verify-email", {
const verifyRes = await fetch("/api/gateway/auth/verify-email", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",
@ -376,7 +376,7 @@ export default function SignupRoute() {
setServerError("");
setSubmitting(true);
try {
const res = await fetch("/api/auth/resend-otp", {
const res = await fetch("/api/gateway/auth/resend-otp", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
credentials: "include",