Spaces:
Sleeping
Sleeping
fix: Move getUser function to component level to fix TypeScript error
Browse files- Extract getUser from useEffect to make it accessible in event handlers
- Fixes 'Cannot find name getUser' compilation error
- Maintains same functionality with proper scoping
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
securecheck-pro/frontend/src/components/AuthButton.tsx
CHANGED
|
@@ -11,13 +11,13 @@ export default function AuthButton() {
|
|
| 11 |
const router = useRouter()
|
| 12 |
const supabase = createClient()
|
| 13 |
|
| 14 |
-
|
| 15 |
-
const
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
}
|
| 20 |
|
|
|
|
| 21 |
getUser()
|
| 22 |
|
| 23 |
const {
|
|
|
|
| 11 |
const router = useRouter()
|
| 12 |
const supabase = createClient()
|
| 13 |
|
| 14 |
+
const getUser = async () => {
|
| 15 |
+
const { data: { session } } = await supabase.auth.getSession()
|
| 16 |
+
setUser(session?.user ?? null)
|
| 17 |
+
setLoading(false)
|
| 18 |
+
}
|
|
|
|
| 19 |
|
| 20 |
+
useEffect(() => {
|
| 21 |
getUser()
|
| 22 |
|
| 23 |
const {
|