Commit Graph

10 Commits

Author SHA1 Message Date
weli adbf73891a router guard: wrap in try/catch, add single-department auto-selection
- Wrap entire beforeEach guard in try/catch to prevent crashes from
  breaking navigation and leaving a blank page
- Add missing next() at end of try block so all code paths resolve
- Integrate switchDepartment() after loadMyDepartments() when exactly
  1 department is available, enabling transparent single-dept flow

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 18:29:54 +08:00
weli 55ae961b2b feat: add department context with single-department transparent support
- Add Department type to types.ts
- Add loadMyDepartments / switchDepartment to store/org.ts
- Auto-load departments after org switch in main.ts
- Single-department orgs auto-select default department
- localStorage persistence for CurrentDepartmentId
2026-05-02 16:37:32 +08:00
weli 9f2ba95b1f fix: read org context from jwt sub claim payload
Parse current_org_id/current_org_role_keys from subject payload when tokens are encoded under claims.sub, so org switch context is correctly detected.

Made-with: Cursor
2026-04-28 00:05:49 +08:00
weli d1caecd9e0 fix: decode org context from jwt payload robustly
Add base64 padding before atob when parsing token payload so current_org_id extraction no longer fails intermittently and loops users back to org select.

Made-with: Cursor
2026-04-27 23:55:24 +08:00
weli 29262d67ec fix: align sudo token with switched auth org context
After org switch, set HtySudoerToken to the refreshed Authorization token so ws endpoints receive current_org_id instead of a sudo2 token without org context.

Made-with: Cursor
2026-04-27 23:40:16 +08:00
weli be5c4fa046 fix: refresh sudo token after org switch
Regenerate HtySudoerToken after switching organization so ws endpoints that read org context from sudo token no longer fail with current_org_id required.

Made-with: Cursor
2026-04-27 23:36:44 +08:00
weli 79a69719b1 fix: auto bootstrap org context outside index route
Ensure authenticated users without current_org_id are redirected or auto-switched before entering business routes, preventing global 500 errors after multi-organization rollout.

Made-with: Cursor
2026-04-27 23:32:48 +08:00
weli be211a2638 fix(front): tabbar 首页直达角色工作台路径;路由与类型调整(music-room 欢迎页等)
Made-with: Cursor
2026-04-26 17:09:42 +08:00
weli b1996f3cd1 fix(wx): strip identity from share page_path; guard router unionid switch
- Sanitize page_path before router.push (H5) to prevent cross-user login via shared link
- onShareAppMessage: remove unionid/openid/status and related query keys from shared path
- main.ts: fix login(to.query.toString()) bug; when already logged in, strip foreign unionid from URL instead of logout

Made-with: Cursor
2026-04-26 15:58:56 +08:00
weli a661e439a0 chore: initialize frontend repo with teaching terminology updates
Add the current frontend codebase with a baseline .gitignore and update piano-specific UI terms to teaching-oriented terms for the current product context.

Made-with: Cursor
2026-04-23 16:37:14 +08:00