Skip to content

Commit

Permalink
fix: set selected relayer
Browse files Browse the repository at this point in the history
  • Loading branch information
debendraoli committed Nov 13, 2024
1 parent 551d682 commit 462a713
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/components/Layout/Dashboard/Header/HeaderRelayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ import Cookies from 'js-cookie'
import { useRouter } from 'next/navigation'
import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle, NavLink } from 'react-bootstrap'

interface HeaderRelayerProps {
relayers: {
id: string
name: string
}[]
}

export default function HeaderRelayer({ relayers }: HeaderRelayerProps) {
const { currentRelayer, setCurrentRelayer } = useRelayer()
export default function HeaderRelayer() {
const { relayers, currentRelayer, setCurrentRelayer } = useRelayer()
const router = useRouter()

const changeRelayer = (id: string) => {
Expand All @@ -24,12 +17,10 @@ export default function HeaderRelayer({ relayers }: HeaderRelayerProps) {
if (selectedRelayer?.id === currentRelayer?.id) {
Cookies.remove('relayerId')
setCurrentRelayer(null)
router.refresh()
} else {
Cookies.set('relayerId', id)
setCurrentRelayer(selectedRelayer)
}
router.refresh()
}

return (
Expand Down

0 comments on commit 462a713

Please sign in to comment.