summaryrefslogtreecommitdiff
path: root/src/modules/profile-card/components/Dropdown.tsx
blob: 6e86c595a1a0af5913332d6f508ec0559ad57091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use client";
import { DropdownItem, DropdownMenu, DropdownTrigger, Dropdown as UIDropdown } from "@nextui-org/react"
import { MoreVerticalIcon } from "lucide-react"
import { deleteCookie } from "cookies-next"

const Dropdown = () => {
  const logout = () => {
    deleteCookie('credential')
    window.location.href = '/login'
  }

  return (
    <UIDropdown>
      <DropdownTrigger>
        <button type="button" className="p-1">
          <MoreVerticalIcon size={20} />
        </button>
      </DropdownTrigger>
      <DropdownMenu>
        <DropdownItem
          key="logout"
          className="text-danger-600"
          color="danger"
          onPress={logout}
        >
          Logout
        </DropdownItem>
      </DropdownMenu>
    </UIDropdown>
  )
}

export default Dropdown