summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Navbar/NavbarUserDropdown.jsx
blob: 7ed269b896124642c6819265fe4ca165327f891b (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
34
35
36
37
38
39
40
41
42
43
44
import { deleteAuth } from '@/core/utils/auth';
import Link from '../Link/Link';
import { useRouter } from 'next/router';
import { signOut, useSession } from 'next-auth/react';
import useAuth from '@/core/hooks/useAuth';

const NavbarUserDropdown = () => {
  const router = useRouter();
  const atuh = useAuth();

  const logout = async () => {
    deleteAuth().then(() => {
      router.push('/login');
    });
  };
  return (
    <div className='navbar-user-dropdown-wrapper'>
      <div className='navbar-user-dropdown'>
        <Link href='/my/profile'>Profil Saya</Link>
        <Link href='/my/quotations'>Daftar Quotation</Link>
        <Link href='/my/transactions'>Daftar Transaksi</Link>
        <Link href='/my/shipments'>Daftar Pengiriman</Link>
        <Link href='/my/invoices'>Invoice & Faktur Pajak</Link>
        {atuh &&
          atuh.partnerTempo &&
          (atuh.partnerTempo?.toLowerCase().includes('tempo') ||
            atuh.tempoProgres === 'review') && (
            <Link href='/my/tempo'>Pembayaran Tempo</Link>
          )}

        <Link href='/my/wishlist'>Wishlist</Link>
        <Link href='/my/address'>Daftar Alamat</Link>
        {!atuh?.external && (
          <Link href='/my/recomendation'>Dashboard Recomendation</Link>
        )}
        <button type='button' onClick={logout}>
          Keluar Akun
        </button>
      </div>
    </div>
  );
};

export default NavbarUserDropdown;