Skip to content

Commit b808775

Browse files
Merge pull request #8 from Shitanshukumar607/add-auth
add logout
2 parents 6a0efb9 + a0b8607 commit b808775

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

components/NavbarComponents/AuthButtons.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,19 @@ const AuthButtons = () => {
1818
fetchUser();
1919
}, [supabase.auth]);
2020

21+
const handleLogout = async () => {
22+
const { error } = await supabase.auth.signOut();
23+
if (!error) setUser(null);
24+
else throw error;
25+
};
26+
2127
return (
2228
<div>
2329
{user ? (
24-
<button className="hidden sm:flex text-xs border border-emerald-500 dark:border-purple-500 px-3 py-1.5 rounded-md hover:bg-emerald-100 dark:hover:bg-violet-900 transition-colors duration-200 items-center gap-1.5">
30+
<button
31+
onClick={handleLogout}
32+
className="hidden sm:flex text-xs border border-emerald-500 dark:border-purple-500 px-3 py-1.5 rounded-md hover:bg-emerald-100 dark:hover:bg-violet-900 transition-colors duration-200 items-center gap-1.5"
33+
>
2534
<span>Logout</span>
2635
{!loading && (
2736
<span className="text-xs opacity-70">{`(${user})`}</span>

next.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
4+
images: {
5+
remotePatterns: [new URL("https://img.icons8.com/**")],
6+
},
57
};
68

79
export default nextConfig;

0 commit comments

Comments
 (0)