2.5 KiB
task, cycles, context, private, started, finished
| task | cycles | context | private | started | finished |
|---|---|---|---|---|---|
| Fix /pos-main showing POS UI shell to unauthenticated users with confusing "Failed to load products" error — improve empty/no-auth state | 3 | true | false | 2026-05-16T15:59:57Z | 2026-05-16T16:01:00Z |
files
- app/Http/Controllers/Support/VueRouteMap.php [lines 93-97] —
/posroute hasloginRequired: false(intentional for POS_TERMINAL access key auth) - resources/js/Pages/PosMain.vue — POS interface; shows "Failed to load products" when no session/access key is present
- resources/js/composables/Market/usePosSession.js — session initialization; sets
posStore.errorwhen no store can be resolved
steps
- In
PosMain.vue, whenposStore.erroris set AND there is nopos_access_keyin localStorage AND the user is not logged in, show a clear "No terminal access" message instead of the bare "Failed to load products" error.- Check:
!userStore.isLoggedIn && !posStore.activeSession && posStore.error - Display: "This terminal has no active session. Please use your POS access key or log in."
- Check:
- (Optional / discuss with owner): Consider adding
allowedUserTypes: ['pos terminal', 'store owner', 'store manager', 'operator', 'super operator', 'ult']to the/posroute while keepingloginRequired: false, so the route map at least documents who is expected to use this page.
context
Current behaviour (confirmed by Playwright): navigating to /pos-main without any session or access key renders the full POS UI shell with:
- "All | Current Order" tab bar
- "Start New Session" button
- "Failed to load products" error banner
- Empty cart with ₱0.00 totals
This is because loginRequired: false is intentional — POS_TERMINAL accounts authenticate via access key (localStorage pos_access_key, prefix PK-), not via the standard mobile/password login. The backend guards on the actual API calls (start session, add item, etc.).
The UI concern: unauthenticated browsers with no access key see a confusing broken state. The fix is a graceful empty state, not removing loginRequired: false.
Dictionary reference: "POS Access Keys: A unique key used to authenticate a POS terminal without a traditional login." and startNewSessionSilently guards against calling the API when both storeHash and access_key are absent.
notes
- dictionary: ai-docs/dictionary.md
- linters: none
- constraints: Do NOT change
loginRequired: falseon/pos— this breaks POS_TERMINAL access key auth. Only improve the UI empty state.