Bug #11763
openproduct quote admin acceptance issue in production
Subtasks
Related issues
Updated by Divya Inapakurthi 5 days ago
Issues & Fixes
Issue 1 (Backend Query & Misleading Error):
Issue: The admin quote approval endpoint was checking customer email link expiration and returning a misleading "Quote not found, expired, or invalid token" error for quotes that exist in the database.
Fix: Removed the customer link expiration check, queried the quote directly by ID, and returned accurate messages like "Quote not found" and "Quote already accepted or paid".
Issue 2 (Frontend Token Desynchronization):
Issue: The quotes API only checked cookies without checking local storage, leading to stale or mismatched user session tokens when switching accounts.
Fix: Updated request headers to check both cookies and local storage so the active user's valid token is always sent.
Issue 3 (Missing Redirect on Session Expiry):
Issue: The quotes API lacked an authentication interceptor, so when a session expired or was invalid (401/403), it showed a failure toast and left the user stuck on the screen thinking the feature was broken.
Fix: Added an authentication interceptor to catch 401/403 errors, clear credentials, show a "Session expired" notice, and automatically navigate the user to the login screen.
Updated by Divya Inapakurthi 5 days ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Remove customer public link expiry (acceptanceTokenExpires) check from acceptQuoteViaAdmin
- Look up quotations directly by quoteId using findById
- Return clear error messages ("Quote not found", "Quote already accepted or paid") instead of the misleading copy-pasted error
- Add baseQueryWithReauth to RTK Query (productquoteApi and quotesApi) to intercept 401/403 errors
- Synchronize token retrieval from both cookies and localStorage to avoid session desync
- Automatically notify user, clear credentials, and redirect to /nursery/evergreen when token expires or becomes invalid