summaryrefslogtreecommitdiff
path: root/frontend/components
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-11 11:51:39 +0100
committerdiogo464 <[email protected]>2025-08-11 11:51:39 +0100
commit4af66f418b6837b6441b4e8eaf2d8ede585238b9 (patch)
tree34a4e913a2848515166b2ac0489794419a33bfcc /frontend/components
parent0d3488a3811c8d58bd570af64cc29840df9ba439 (diff)
snapshot
Diffstat (limited to 'frontend/components')
-rw-r--r--frontend/components/AuthButton.tsx31
1 files changed, 31 insertions, 0 deletions
diff --git a/frontend/components/AuthButton.tsx b/frontend/components/AuthButton.tsx
new file mode 100644
index 0000000..05c493c
--- /dev/null
+++ b/frontend/components/AuthButton.tsx
@@ -0,0 +1,31 @@
1import { Auth_get_user, Auth_tinyauth_public_endpoint } from '@/lib/auth'
2
3export default async function AuthButton() {
4 const user = await Auth_get_user()
5 const authEndpoint = Auth_tinyauth_public_endpoint()
6
7 if (user.isLoggedIn) {
8 return (
9 <div className="flex items-center gap-4">
10 <span className="text-sm text-gray-600 dark:text-gray-300">
11 {user.email}
12 </span>
13 <a
14 href={authEndpoint}
15 className="px-3 py-1 text-sm bg-red-600 hover:bg-red-700 text-white rounded transition-colors"
16 >
17 Logout
18 </a>
19 </div>
20 )
21 }
22
23 return (
24 <a
25 href={authEndpoint}
26 className="px-3 py-1 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded transition-colors"
27 >
28 Login
29 </a>
30 )
31} \ No newline at end of file