Skip to content

Commit

Permalink
Connect user switching with the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
MytsV committed Aug 8, 2024
1 parent f2ba621 commit f1c238f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/component-library/Pages/Layout/AccountDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AccountList = (props: { accountList: string[] }) => {
"text-right"
)}
key={index}
href="/api/account/switch"
href={`/api/auth/switch?account=${account}`}
prefetch={false}
>
<HiSwitchHorizontal className="text-2xl text-text-900 dark:text-text-100 shrink-0"/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/auth/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function switchUsers(req: NextApiRequest, res: NextApiResponse) {

const user = session.allUsers?.at(userIdx!)
await addOrUpdateSessionUser(session, user!, true)
res.redirect(callbackUrl as string ?? '/dashboard')
res.redirect(callbackUrl as string ?? '/')
}

export default withSessionRoute(switchUsers)

0 comments on commit f1c238f

Please sign in to comment.