MCPcopy Create free account
hub / github.com/experdot/pointer / switchAccount

Function switchAccount

src/renderer/src/services/accountService.ts:64–84  ·  view source on GitHub ↗
(accountId: string)

Source from the content-addressed store, hash-verified

62
63// 切换账户
64export async function switchAccount(accountId: string): Promise<void> {
65 const { account } = stores
66
67 // 验证账户存在
68 const targetAccount = account.getById(accountId)
69 if (!targetAccount) {
70 throw new Error(`Account not found: ${accountId}`)
71 }
72
73 await runSwitchTransaction('account', targetAccount.name, async () => {
74 await account.setCurrentAccountId(accountId)
75 await persistence.database.commitContext({
76 accountId,
77 workspacePath: null
78 })
79 resetWorkspaceSystem()
80 resetAccountStores()
81 await initAccountStores()
82 await initializeWorkspaceSystem()
83 })
84}
85
86// 创建新账户
87export async function createAccount(name: string, avatar?: string): Promise<Account> {

Callers 3

handleSwitchAccountFunction · 0.90
handleCreateAccountFunction · 0.90
logoutFunction · 0.85

Calls 8

runSwitchTransactionFunction · 0.90
resetWorkspaceSystemFunction · 0.90
resetAccountStoresFunction · 0.85
initAccountStoresFunction · 0.85
commitContextMethod · 0.80
getByIdMethod · 0.65
setCurrentAccountIdMethod · 0.65

Tested by

no test coverage detected