diff --git a/.claude/launch.json b/.claude/launch.json index 5749d83..0ed8ed3 100644 --- a/.claude/launch.json +++ b/.claude/launch.json @@ -5,7 +5,7 @@ "name": "frontend-solid", "runtimeExecutable": "npm", "runtimeArgs": ["run", "dev"], - "port": 3000 + "port": 3001 } ] } diff --git a/src/components/dashboard/CompanyApplicationsPage.tsx b/src/components/dashboard/CompanyApplicationsPage.tsx index fdfe121..8a10678 100644 --- a/src/components/dashboard/CompanyApplicationsPage.tsx +++ b/src/components/dashboard/CompanyApplicationsPage.tsx @@ -9,7 +9,7 @@ import { For, Show, createSignal, onMount } from "solid-js"; import { BTN_GHOST, BTN_ORANGE, CARD, INPUT, LABEL } from "~/components/DashboardShell"; -const API = "/api"; +const API = ""; interface JobItem { id: string; @@ -49,8 +49,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/CompanyJobsPage.tsx b/src/components/dashboard/CompanyJobsPage.tsx index 4493498..1222aa5 100644 --- a/src/components/dashboard/CompanyJobsPage.tsx +++ b/src/components/dashboard/CompanyJobsPage.tsx @@ -19,7 +19,7 @@ import { LABEL, } from "~/components/DashboardShell"; -const API = "/api"; +const API = ""; interface JobItem { id: string; diff --git a/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx b/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx index 20a8e30..92e78c1 100644 --- a/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx +++ b/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx @@ -1,7 +1,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { BTN_GHOST, CARD } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; type JobItem = { id: string; title: string }; type ApplicationItem = { @@ -18,8 +18,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/CreditsPage.tsx b/src/components/dashboard/CreditsPage.tsx index 4e23437..cf6537a 100644 --- a/src/components/dashboard/CreditsPage.tsx +++ b/src/components/dashboard/CreditsPage.tsx @@ -4,7 +4,7 @@ import { BTN_GHOST, BTN_ORANGE, BTN_PRIMARY, CARD, ORANGE, NAVY, PKG_CARD } from import { PROFESSIONAL_ROLE_SET, ROLE_PREFIXES, type RoleKey } from "./RoleDashboardShared"; import { openPayuCheckout, submitPayuCheckout } from "~/lib/payu"; -const API = "/api"; +const API = ""; type Props = { roleKey: RoleKey; dashboardConfig?: Record | null }; @@ -79,8 +79,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { @@ -421,11 +420,20 @@ export default function CreditsPage(props: Props) { return; } - const paymentResult = await openPayuCheckout({ + const paymentResult = await submitPayuCheckout({ + key: orderData.key, + txnid: orderData.txnid || orderData.order_id, amount: orderData.amount, - currency: orderData.currency, - txnId: orderData.txnid || orderData.order_id, - description: `${pkg.name} - ${pkg.tracecoins_amount} Tracecoins`, + productinfo: orderData.productinfo, + firstname: orderData.firstname, + email: orderData.email, + phone: orderData.phone || "", + surl: orderData.surl, + furl: orderData.furl, + hash: orderData.hash, + payu_base_url: orderData.payu_base_url, + udf1: orderData.udf1, + udf2: orderData.udf2, }); const verifyRes = await apiFetch("/api/payments/verify", { @@ -490,247 +498,241 @@ export default function CreditsPage(props: Props) { }; const CheckoutModal = () => { - const state = checkout(); - const pkg = state.package; - const aiPkg = state.aiCreditPackage; - if (!pkg && !aiPkg) return null; - - const title = pkg ? `${pkg.tracecoins_amount} Tracecoins` : `${aiPkg!.credits} AI Credits`; - const price = pkg ? pkg.price : aiPkg!.price_inr; - return ( - -
{ - if (e.target === e.currentTarget && state.step !== "processing") closeCheckout(); - }} - > + +
{ + if (e.target === e.currentTarget && checkout().step !== "processing") closeCheckout(); }} > - {/* Header */}
-

- {state.step === "success" - ? "✓ Payment Successful" - : state.step === "error" - ? "Payment Failed" - : "Checkout"} -

- - - -
- - {/* Package Summary */} - + {/* Header */}
-

Package

-

- {pkg ? pkg.name : aiPkg?.name} -

-

- {formatCurrency(price)} -

-

- +{title} -

-
-
- - {/* Success State */} - -
-
🎉
-

- Payment successful! -

-

- {title} have been credited to your account. -

-

- Order ID: {state.orderId} -

-
- -
- - {/* Error State */} - -
-
-

- {state.error || "Payment failed. Please try again."} -

-
-
- - -
-
- - {/* Processing State */} - -
-
-
+ +
-

- Processing Payment... -

-

- Please wait while we process your payment. -

-
- - - {/* Payment Form */} - -
- -
- {state.error} -
+ × +
+
- {/* PayU Notice */} + {/* Package Summary */} +
- PayU Secure Checkout will open in a secure page. Cancelled or failed - payments will not be credited. +

Package

+

+ {checkout().package ? checkout().package!.name : checkout().aiCreditPackage?.name} +

+

+ {formatCurrency(checkout().package ? checkout().package!.price : checkout().aiCreditPackage!.price_inr)} +

+

+ +{checkout().package ? `${checkout().package!.tracecoins_amount} Tracecoins` : `${checkout().aiCreditPackage!.credits} AI Credits`} +

+
- {/* Pay Button */} + {/* Success State */} + +
+
🎉
+

+ Payment successful! +

+

+ {checkout().package ? `${checkout().package!.tracecoins_amount} Tracecoins` : `${checkout().aiCreditPackage!.credits} AI Credits`} have been credited to your account. +

+

+ Order ID: {checkout().orderId} +

+
+
-

- Secure payment powered by PayU -

-
-
+ {/* Error State */} + +
+
+

+ {checkout().error || "Payment failed. Please try again."} +

+
+
+ + +
+
+ + {/* Processing State */} + +
+
+
+
+

+ Processing Payment... +

+

+ Please wait while we process your payment. +

+
+ + + {/* Payment Form */} + +
+ +
+ {checkout().error} +
+
+ + {/* PayU Notice */} +
+ PayU Secure Checkout will open in a secure page. Cancelled or failed + payments will not be credited. +
+ + {/* Pay Button */} + + +

+ Secure payment powered by PayU +

+
+
+
-
- -
+ + + ); }; diff --git a/src/components/dashboard/CustomerBrowseProfessionalsPage.tsx b/src/components/dashboard/CustomerBrowseProfessionalsPage.tsx index c5796d1..705854c 100644 --- a/src/components/dashboard/CustomerBrowseProfessionalsPage.tsx +++ b/src/components/dashboard/CustomerBrowseProfessionalsPage.tsx @@ -1,7 +1,7 @@ import { For, Show, createSignal } from 'solid-js'; import { BTN_GHOST, BTN_ORANGE, BTN_PRIMARY, CARD, INPUT, LABEL } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; const NAVY = '#0D0D2A'; const ORANGE = '#FF5E13'; @@ -10,8 +10,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/CustomerRequirementsPage.tsx b/src/components/dashboard/CustomerRequirementsPage.tsx index d82d974..57797d3 100644 --- a/src/components/dashboard/CustomerRequirementsPage.tsx +++ b/src/components/dashboard/CustomerRequirementsPage.tsx @@ -9,7 +9,7 @@ import { For, Show, createMemo, createSignal, onMount } from "solid-js"; import { BTN_GHOST, BTN_PRIMARY, CARD, INPUT, LABEL } from "~/components/DashboardShell"; -const API = "/api"; +const API = ""; type RequirementItem = { id: string; @@ -30,8 +30,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/CustomerResponsesPage.tsx b/src/components/dashboard/CustomerResponsesPage.tsx index 6ec53a0..c51e5f4 100644 --- a/src/components/dashboard/CustomerResponsesPage.tsx +++ b/src/components/dashboard/CustomerResponsesPage.tsx @@ -1,8 +1,6 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { BTN_GHOST, BTN_ORANGE, CARD, INPUT, LABEL } from '~/components/DashboardShell'; -const API = '/api/gateway'; - type RequirementItem = { id: string; title: string; @@ -28,8 +26,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(path, { ...opts, credentials: "include", headers: { @@ -84,7 +81,7 @@ export default function CustomerResponsesPage(props: Props) { setLoadingRows(true); setErr(''); try { - const res = await apiFetch(`/api/leads/customer/${requirementId}`); + const res = await apiFetch(`/api/customers/requests?lead_id=${requirementId}&page=1&limit=50`); const payload = await res.json().catch(() => ({})); if (!res.ok) { setRows([]); diff --git a/src/components/dashboard/ExploreServicesPage.tsx b/src/components/dashboard/ExploreServicesPage.tsx index 8d50b1e..ab87aa7 100644 --- a/src/components/dashboard/ExploreServicesPage.tsx +++ b/src/components/dashboard/ExploreServicesPage.tsx @@ -5,7 +5,7 @@ import { Camera, Scissors, GraduationCap, Code2, Clapperboard, PenTool, Megaphon const NAVY = "#0D0D2A"; const ORANGE = "#FF5E13"; -const API = "/api"; +const API = ""; const MAIN_ROLES = [ { key: "COMPANY", name: "Company", Icon: Users, subtitle: "Hire talent, post jobs, and manage applications in one path." }, @@ -40,8 +40,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/HelpCenterDashboardPage.tsx b/src/components/dashboard/HelpCenterDashboardPage.tsx index a343cbf..e295d09 100644 --- a/src/components/dashboard/HelpCenterDashboardPage.tsx +++ b/src/components/dashboard/HelpCenterDashboardPage.tsx @@ -3,7 +3,7 @@ import { HelpCircle } from "lucide-solid"; import { BTN_GHOST, CARD, INPUT } from "~/components/DashboardShell"; import { type RoleKey } from "./RoleDashboardShared"; -const API = "/api"; +const API = ""; const NAVY = "#0D0D2A"; const ORANGE = "#FF5E13"; @@ -24,8 +24,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/JobSeekerApplicationsPage.tsx b/src/components/dashboard/JobSeekerApplicationsPage.tsx index d88f279..09a4d3a 100644 --- a/src/components/dashboard/JobSeekerApplicationsPage.tsx +++ b/src/components/dashboard/JobSeekerApplicationsPage.tsx @@ -1,7 +1,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { BTN_GHOST, BTN_PRIMARY, CARD } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; type ApplicationItem = { id: string; @@ -17,8 +17,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/JobSeekerJobsPage.tsx b/src/components/dashboard/JobSeekerJobsPage.tsx index ad1be44..e49033d 100644 --- a/src/components/dashboard/JobSeekerJobsPage.tsx +++ b/src/components/dashboard/JobSeekerJobsPage.tsx @@ -11,7 +11,7 @@ import { Sparkles, Loader } from "lucide-solid"; import { BTN_GHOST, BTN_PRIMARY, CARD, INPUT } from "~/components/DashboardShell"; import { readJobSeekerProfile, updateJobSeekerCustomData } from "~/lib/job-seeker-custom-data"; -const API = "/api"; +const API = ""; type JobItem = { id: string; diff --git a/src/components/dashboard/LogoutPage.tsx b/src/components/dashboard/LogoutPage.tsx index 923908a..c51003d 100644 --- a/src/components/dashboard/LogoutPage.tsx +++ b/src/components/dashboard/LogoutPage.tsx @@ -2,7 +2,7 @@ import { createSignal } from 'solid-js'; import { LogOut } from 'lucide-solid'; import { BTN_GHOST, BTN_ORANGE, CARD } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; const NAVY = '#0D0D2A'; const ORANGE = '#FF5E13'; @@ -11,8 +11,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/MyDashboardPage.tsx b/src/components/dashboard/MyDashboardPage.tsx index a45e28f..45d5ad9 100644 --- a/src/components/dashboard/MyDashboardPage.tsx +++ b/src/components/dashboard/MyDashboardPage.tsx @@ -23,7 +23,7 @@ import { // Inline apiFetch matching ProfilePage pattern async function apiFetch(path: string, opts?: RequestInit) { - const API = '/api/gateway'; + const API = ''; const token = typeof window !== 'undefined' ? (sessionStorage.getItem('nxtgauge_access_token') || '') : ''; diff --git a/src/components/dashboard/NotificationsPage.tsx b/src/components/dashboard/NotificationsPage.tsx index 9f80a7b..81ac498 100644 --- a/src/components/dashboard/NotificationsPage.tsx +++ b/src/components/dashboard/NotificationsPage.tsx @@ -2,7 +2,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { Bell } from 'lucide-solid'; import { BTN_GHOST, BTN_ORANGE, CARD } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; const NAVY = '#0D0D2A'; const ORANGE = '#FF5E13'; @@ -11,8 +11,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/PortfolioPage.tsx b/src/components/dashboard/PortfolioPage.tsx index 6e32707..a433bab 100644 --- a/src/components/dashboard/PortfolioPage.tsx +++ b/src/components/dashboard/PortfolioPage.tsx @@ -8,7 +8,7 @@ import { Coins, Image, BriefcaseBusiness, UserCircle2, CheckCircle2 } from 'luci import { CARD, BTN_GHOST, BTN_PRIMARY, INPUT, LABEL, NAVY } from '~/components/DashboardShell'; import { readJobSeekerProfile, updateJobSeekerCustomData } from '~/lib/job-seeker-custom-data'; -const API = '/api/gateway'; +const API = ''; const BTN_NAVY = { height: '36px', diff --git a/src/components/dashboard/ProfessionalLeadsPage.tsx b/src/components/dashboard/ProfessionalLeadsPage.tsx index 59a2bfe..36786e2 100644 --- a/src/components/dashboard/ProfessionalLeadsPage.tsx +++ b/src/components/dashboard/ProfessionalLeadsPage.tsx @@ -9,7 +9,7 @@ import { For, Show, createMemo, createSignal, onMount } from "solid-js"; import { BTN_GHOST, BTN_PRIMARY, CARD, INPUT } from "~/components/DashboardShell"; import { ROLE_PREFIXES, type RoleKey } from "./RoleDashboardShared"; -const API = "/api"; +const API = ""; type Props = { roleKey: RoleKey }; diff --git a/src/components/dashboard/ProfessionalResponsesPage.tsx b/src/components/dashboard/ProfessionalResponsesPage.tsx index 43c5053..450a148 100644 --- a/src/components/dashboard/ProfessionalResponsesPage.tsx +++ b/src/components/dashboard/ProfessionalResponsesPage.tsx @@ -2,7 +2,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { BTN_GHOST, CARD } from '~/components/DashboardShell'; import { ROLE_PREFIXES, type RoleKey } from './RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; type Props = { roleKey: RoleKey }; @@ -20,8 +20,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/ProfilePage.tsx b/src/components/dashboard/ProfilePage.tsx index 4f46b95..eff635a 100644 --- a/src/components/dashboard/ProfilePage.tsx +++ b/src/components/dashboard/ProfilePage.tsx @@ -638,7 +638,7 @@ export default function ProfilePage(props: Props) { return Array.from(new Set(missing)); } const data = await res.json().catch(() => []); - const items = Array.isArray(data) ? data : data?.items ?? []; + const items = Array.isArray(data) ? data : data?.items ?? data?.data ?? []; if (!Array.isArray(items) || items.length === 0) missing.push("Showcase items"); } catch { missing.push("Showcase items"); @@ -863,7 +863,7 @@ export default function ProfilePage(props: Props) { method: "POST", body: { roleKey: props.roleKey, profile_data: { ...form(), ...docUrls() } }, }); - if (status === 200) { + if (status === 200 || status === 201) { setVerificationStatus("PENDING"); props.onVerificationStatusChange?.("PENDING"); setSubmitMsg("Submitted! We will review your profile and notify you."); diff --git a/src/components/dashboard/SettingsPage.tsx b/src/components/dashboard/SettingsPage.tsx index de77d89..acf502e 100644 --- a/src/components/dashboard/SettingsPage.tsx +++ b/src/components/dashboard/SettingsPage.tsx @@ -2,7 +2,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { Settings as SettingsIcon } from 'lucide-solid'; import { BTN_GHOST, BTN_ORANGE, BTN_PRIMARY, CARD, INPUT, LABEL } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; const NAVY = '#0D0D2A'; const ORANGE = '#FF5E13'; @@ -11,8 +11,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/SwitchServicesPage.tsx b/src/components/dashboard/SwitchServicesPage.tsx index a139b40..1cbaa7e 100644 --- a/src/components/dashboard/SwitchServicesPage.tsx +++ b/src/components/dashboard/SwitchServicesPage.tsx @@ -2,7 +2,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'; import { RefreshCw } from 'lucide-solid'; import { BTN_GHOST, BTN_PRIMARY, CARD } from '~/components/DashboardShell'; -const API = '/api/gateway'; +const API = ''; const NAVY = '#0D0D2A'; const ORANGE = '#FF5E13'; @@ -18,8 +18,7 @@ async function apiFetch(path: string, opts?: RequestInit) { typeof window !== "undefined" ? window.sessionStorage.getItem("nxtgauge_access_token") || "" : ""; - const cleanPath = path.startsWith("/api/") ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: "include", headers: { diff --git a/src/components/dashboard/widgets/AiUsageWidget.tsx b/src/components/dashboard/widgets/AiUsageWidget.tsx index b85b6f2..9342a06 100644 --- a/src/components/dashboard/widgets/AiUsageWidget.tsx +++ b/src/components/dashboard/widgets/AiUsageWidget.tsx @@ -4,15 +4,14 @@ import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; import { ROLE_PREFIXES } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/ApplicationsWidget.tsx b/src/components/dashboard/widgets/ApplicationsWidget.tsx index 4f7b2cf..cb3262d 100644 --- a/src/components/dashboard/widgets/ApplicationsWidget.tsx +++ b/src/components/dashboard/widgets/ApplicationsWidget.tsx @@ -3,15 +3,14 @@ import { FileText } from 'lucide-solid'; import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/JobsWidget.tsx b/src/components/dashboard/widgets/JobsWidget.tsx index f8ae00c..d461557 100644 --- a/src/components/dashboard/widgets/JobsWidget.tsx +++ b/src/components/dashboard/widgets/JobsWidget.tsx @@ -3,15 +3,14 @@ import { Briefcase } from 'lucide-solid'; import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/LeadsWidget.tsx b/src/components/dashboard/widgets/LeadsWidget.tsx index f3d9005..735cfdc 100644 --- a/src/components/dashboard/widgets/LeadsWidget.tsx +++ b/src/components/dashboard/widgets/LeadsWidget.tsx @@ -4,15 +4,14 @@ import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; import { PROFESSIONAL_ROLE_SET, ROLE_PREFIXES } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/ProfileCompletionWidget.tsx b/src/components/dashboard/widgets/ProfileCompletionWidget.tsx index deb4977..fa58625 100644 --- a/src/components/dashboard/widgets/ProfileCompletionWidget.tsx +++ b/src/components/dashboard/widgets/ProfileCompletionWidget.tsx @@ -5,15 +5,14 @@ import type { RoleKey } from '../RoleDashboardShared'; import { PROFESSIONAL_ROLE_SET, ROLE_PREFIXES } from '../RoleDashboardShared'; import { fetchProfile } from '~/lib/api'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/RequirementsWidget.tsx b/src/components/dashboard/widgets/RequirementsWidget.tsx index 741278c..7617165 100644 --- a/src/components/dashboard/widgets/RequirementsWidget.tsx +++ b/src/components/dashboard/widgets/RequirementsWidget.tsx @@ -3,15 +3,14 @@ import { ClipboardList } from 'lucide-solid'; import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/ShortlistedWidget.tsx b/src/components/dashboard/widgets/ShortlistedWidget.tsx index 4aa9347..c0b62a1 100644 --- a/src/components/dashboard/widgets/ShortlistedWidget.tsx +++ b/src/components/dashboard/widgets/ShortlistedWidget.tsx @@ -3,15 +3,14 @@ import { Star } from 'lucide-solid'; import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/VerificationWidget.tsx b/src/components/dashboard/widgets/VerificationWidget.tsx index 8fc791a..c660c2f 100644 --- a/src/components/dashboard/widgets/VerificationWidget.tsx +++ b/src/components/dashboard/widgets/VerificationWidget.tsx @@ -3,15 +3,14 @@ import { ShieldCheck } from 'lucide-solid'; import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/components/dashboard/widgets/WalletWidget.tsx b/src/components/dashboard/widgets/WalletWidget.tsx index c77f1c7..286235e 100644 --- a/src/components/dashboard/widgets/WalletWidget.tsx +++ b/src/components/dashboard/widgets/WalletWidget.tsx @@ -4,15 +4,14 @@ import DashboardWidget from './DashboardWidget'; import type { RoleKey } from '../RoleDashboardShared'; import { ROLE_PREFIXES } from '../RoleDashboardShared'; -const API = '/api/gateway'; +const API = ''; async function apiFetch(path: string, opts?: RequestInit) { const token = typeof window !== 'undefined' ? window.sessionStorage.getItem('nxtgauge_access_token') || '' : ''; - const cleanPath = path.startsWith('/api/') ? path.slice(4) : path; - return fetch(`${API}${cleanPath}`, { + return fetch(`${API}${path}`, { ...opts, credentials: 'include', headers: { diff --git a/src/routes/dashboard.tsx b/src/routes/dashboard.tsx index 9c147a1..b8aaec3 100644 --- a/src/routes/dashboard.tsx +++ b/src/routes/dashboard.tsx @@ -250,6 +250,7 @@ const ROLE_BASED_SIDEBAR: Record = { "Jobs", "Applications", "Shortlisted Candidates", + "Credits", "Explore Nxtgauge", "Verification", "Help Center", diff --git a/src/routes/dashboard/wallet/buy.tsx b/src/routes/dashboard/wallet/buy.tsx index d8ddada..a4756df 100644 --- a/src/routes/dashboard/wallet/buy.tsx +++ b/src/routes/dashboard/wallet/buy.tsx @@ -45,7 +45,7 @@ export default function BuyTracecoinsPage() { const [packages] = createResource(async () => { const roleKey = resolveRoleKey(); - const res = await api.get(`/pricing/packages?role=${encodeURIComponent(roleKey)}&roleKey=${encodeURIComponent(roleKey)}`); + const res = await api.get(`/packages?role=${encodeURIComponent(roleKey)}&roleKey=${encodeURIComponent(roleKey)}`); return res.data?.packages || []; });