(accountId: string)
| 98 | |
| 99 | // 删除账户 |
| 100 | export async function removeAccount(accountId: string): Promise<void> { |
| 101 | const { account } = stores |
| 102 | |
| 103 | // 不能删除默认账户 |
| 104 | if (accountId === getDefaultAccountId()) { |
| 105 | throw new Error('Cannot delete default account') |
| 106 | } |
| 107 | |
| 108 | // 不能删除当前账户 |
| 109 | if (accountId === account.currentAccountId) { |
| 110 | throw new Error('Cannot delete current account') |
| 111 | } |
| 112 | |
| 113 | // 先从列表中移除,再删除数据 |
| 114 | await account.delete(accountId) |
| 115 | } |
| 116 | |
| 117 | // 获取当前账户 |
| 118 | export function getCurrentAccount(): Account | null { |
nothing calls this directly
no test coverage detected