Skip to content

Commit

Permalink
ENH: Implement ToastProvider for logging out process
Browse files Browse the repository at this point in the history
  • Loading branch information
adjiap committed Jul 5, 2024
1 parent eb2fc86 commit 61adf46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Sidebar from "@/components/sidebar"
import SupabaseProvider from "@/providers/SupabaseProvider";
import UserProvider from "@/providers/UserProvider";
import ModalProvider from "@/providers/ModalProvider";
import ToasterProvider from "@/providers/ToasterProvider";

const font = Figtree({ subsets: ["latin"] });

Expand All @@ -21,6 +22,7 @@ export default function RootLayout({
return (
<html lang="en">
<body className={font.className}>
<ToasterProvider/>
{/* Adding custom SupabaseProvider to wrap our application with the Supabase client */}
<SupabaseProvider>
<UserProvider>
Expand Down
5 changes: 4 additions & 1 deletion components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useAuthModal from "@/hooks/useAuthModal";
import { useSupabaseClient } from "@supabase/auth-helpers-react";
import { useUser } from "@/hooks/useUsers";
import { FaUserAlt } from "react-icons/fa";
import toast from "react-hot-toast";

interface HeaderProps{
children: React.ReactNode;
Expand All @@ -32,7 +33,9 @@ const Header: React.FC<HeaderProps> = ({
// TODO: reset any playing songs
router.refresh();
if (error){
console.log(error);
toast.error(error.message);
} else {
toast.success("Logged out!");
}
}

Expand Down

0 comments on commit 61adf46

Please sign in to comment.