"use client"; import { useState } from "react"; import { Github } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; export default function LoginPage() { const [isLoading, setIsLoading] = useState(false); const handleGitHubLogin = async () => { setIsLoading(true); try { // Get the callbackUrl from the URL if present const urlParams = new URLSearchParams(window.location.search); const callbackUrl = urlParams.get('callbackUrl'); // Use the API service to get the GitHub OAuth URL const { url } = await import('@/lib/api').then(module => module.authAPI.getGitHubOAuthUrl() ); // Store the callbackUrl in sessionStorage to use after authentication if (callbackUrl) { sessionStorage.setItem('callbackUrl', callbackUrl); } // Redirect to GitHub OAuth page window.location.href = url; } catch (error) { console.error('Login error:', error); setIsLoading(false); // You could add error handling UI here } }; return (
En vous connectant, vous acceptez nos conditions d'utilisation et notre politique de confidentialité.