/admin/post-inspection-revenue). Export lives in ConciergeAdoptionSection only (ProPair section has no export).callServerAction, which forwards the authjs.session_token cookie from the Next server to the API. Export uses clientApiFetch (browser fetch with credentials: 'include' directly to NEXT_PUBLIC_SERVER_URL). On Admin production (cross-origin to API), the session cookie often does not reach the API → 401 from auth middleware in login.ts. The export error handler only reads message / error from JSON bodies; auth failures return { result: 'failed', reason: '...' }, so the UI shows a generic “Export failed” title with no description.GET /homebinder/export/by-inspection-date and GET /homebinder/export/sent-spreadsheet, both behind requireAdminPerm('admin-post-inspection-revenue-view') in homebinder.ts. CSV builders in exportHomeBinderResults.ts and exportHomeBinderSentSpreadsheet.ts return validation errors as { message } or CSV on success (empty data → header-only CSV, not an error).admin-post-inspection-revenue-view via adminLoginCheck in the Post-Inspection Revenue layout.companyIds, startDate, endDate).callServerAction or a server action returning CSV) rather than browser-direct clientApiFetch; dev owns approach.Frontend (attik-frontend)
src/app/admin/post-inspection-revenue/_components/ConciergeAdoptionSection.tsx — handleExport calls clientApiFetch to homebinder/export/...; error parsing in catch block (lines ~252–282).src/app/admin/post-inspection-revenue/PostInspectionRevenueClient.tsx — passes exportParams from applied filters; dashboard loads via callServerAction to post-inspection-revenue/concierge-adoption (working path to mirror).src/util/functions/fetching/clientApiFetch.ts vs src/util/functions/fetching/callServerAction.ts — auth/cookie forwarding difference is the likely break.src/app/admin/post-inspection-revenue/layout.tsx — page permission gate.Backend (attik-backend)
src/routes/homebinder.ts — export route handlers + requireAdminPerm('admin-post-inspection-revenue-view').src/util/functions/homebinder/exportHomeBinderResults.ts — by-inspection-date CSV aggregation.src/util/functions/homebinder/exportHomeBinderSentSpreadsheet.ts — sent-spreadsheet CSV.src/routes/login.ts — session auth middleware; 401 body shape { result, reason }.src/routes/adminPostInspectionRevenue.ts — concierge-adoption data endpoint (reference for working auth path).src/util/functions/admin/hasAdminPerm.ts — admin permission check.Out of scope
admin-post-inspection-revenue-view) can export By Inspection Date CSV from Concierge Adoption on Admin production.companyIds, startDate, endDate)./admin/post-inspection-revenue)attik-frontend/src/app/admin/post-inspection-revenue/_components/ConciergeAdoptionSection.tsxattik-backend/src/routes/homebinder.tsPlease authenticate to join the conversation.
Planned
Main App
About 3 hours ago
Linear
Get notified by email when there are changes.
Planned
Main App
About 3 hours ago
Linear
Get notified by email when there are changes.