import Link from 'next/link'; import { useRouter } from 'next/router'; import React, { useState } from 'react'; import toast from 'react-hot-toast'; import Icon from './Icon'; type TopbarProps = { showSettings: Function, showAddModal: Function, } const TopBar = ({ showSettings, showAddModal }:TopbarProps) => { const [showMobileMenu, setShowMobileMenu] = useState(false); const router = useRouter(); const isDomainsPage = router.pathname === '/domains'; const logoutUser = async () => { try { const fetchOpts = { method: 'POST', headers: new Headers({ 'Content-Type': 'application/json', Accept: 'application/json' }) }; const res = await fetch(`${window.location.origin}/api/logout`, fetchOpts).then((result) => result.json()); console.log(res); if (!res.success) { toast(res.error, { icon: '⚠️' }); } else { router.push('/login'); } } catch (fetchError) { toast('Could not login, Ther Server is not responsive.', { icon: '⚠️' }); } }; return (

SerpBear

{!isDomainsPage && ( )}
); }; export default TopBar;