Skip to content

Commit 53f6c34

Browse files
authored
Merge pull request #1974 from stackernews/rename-to-next-account
Fix missing rename to nextAccount
2 parents 0d93c92 + 54e7793 commit 53f6c34

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/account.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const AccountProvider = ({ children }) => {
5050
setAccounts(accounts => accounts.filter(({ id }) => id !== userId))
5151
}, [])
5252

53-
const multiAuthSignout = useCallback(async () => {
53+
const nextAccount = useCallback(async () => {
5454
const { status } = await fetch('/api/next-account', { credentials: 'include' })
5555
// if status is 302, this means the server was able to switch us to the next available account
5656
// and the current account was simply removed from the list of available accounts including the corresponding JWT.
@@ -66,8 +66,8 @@ export const AccountProvider = ({ children }) => {
6666
}, [])
6767

6868
const value = useMemo(
69-
() => ({ accounts, addAccount, removeAccount, meAnon, setMeAnon, multiAuthSignout }),
70-
[accounts, addAccount, removeAccount, meAnon, setMeAnon, multiAuthSignout])
69+
() => ({ accounts, addAccount, removeAccount, meAnon, setMeAnon, nextAccount }),
70+
[accounts, addAccount, removeAccount, meAnon, setMeAnon, nextAccount])
7171
return <AccountContext.Provider value={value}>{children}</AccountContext.Provider>
7272
}
7373

components/nav/common.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export default function LoginButton () {
269269
function LogoutObstacle ({ onClose }) {
270270
const { registration: swRegistration, togglePushSubscription } = useServiceWorker()
271271
const { removeLocalWallets } = useWallets()
272-
const { multiAuthSignout } = useAccounts()
272+
const { nextAccount } = useAccounts()
273273
const router = useRouter()
274274

275275
return (
@@ -285,9 +285,9 @@ function LogoutObstacle ({ onClose }) {
285285
</Button>
286286
<Button
287287
onClick={async () => {
288-
const switchSuccess = await multiAuthSignout()
289-
// only signout if multiAuth did not find a next available account
290-
if (switchSuccess) {
288+
const next = await nextAccount()
289+
// only signout if we did not find a next account
290+
if (next) {
291291
onClose()
292292
// reload whatever page we're on to avoid any bugs
293293
router.reload()

0 commit comments

Comments
 (0)