Skip to content

feat(home): add quick account switcher in landscape header#74

Open
gushishang wants to merge 1 commit into
mainfrom
codex/add-quick-account-switch-feature
Open

feat(home): add quick account switcher in landscape header#74
gushishang wants to merge 1 commit into
mainfrom
codex/add-quick-account-switch-feature

Conversation

@gushishang
Copy link
Copy Markdown
Member

Motivation

  • Provide a fast way to switch between up to three bound accounts from the header on wide (landscape) screens without changing existing stored data.

Description

  • Add a named right slot to src/components/utils/Header.vue so views can inject controls into the header right area.
  • Implement a quick-switch UI in src/views/Home.vue that shows an avatar on the header right in non-portrait layout, opens a small panel with up to 3 saved accounts, and allows immediate switching by clicking an account.
  • Persist quick accounts under a new storage key quickSwitchAccounts (declared in src/services/storage/index.ts) and deduplicate by user id while keeping previous storage keys and values untouched.
  • Switching writes the selected credentials into userAuthInfo and calls login(token, authCode, true) to refresh the current user state; current account is saved to the quick list on auth refresh or login events.

Testing

  • Ran lint via npm run -s eslint which completed successfully (repo pre-existing warnings remain; no new errors introduced).

Codex Task

@gushishang
Copy link
Copy Markdown
Member Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd6fe94e0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/views/Home.vue

async function switchAccount(account: QuickAccount) {
showSwitchPanel.value = false
sm.setObj('userAuthInfo', { token: account.token, authCode: account.authCode }, 30 * 24 * 60 * 60 * 1000)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Write switched credentials after successful authentication

Persisting userAuthInfo before checking login(...) success can overwrite a currently valid session with invalid/stale credentials. When a quick-switch account token has expired or been revoked, switchAccount returns early at !res.Data?.User but leaves userAuthInfo set to the bad token/authCode, so subsequent app startup/auth flows use broken credentials instead of the prior working account.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant