Skip to content

Commit

Permalink
Fix import errors in Login page
Browse files Browse the repository at this point in the history
Resolved issues related to the import of the Supabase client in the Login page. Ensured that the correct path is used for importing the Supabase client and addressed TypeScript errors related to the Auth component's props.
[skip gpt_engineer]
  • Loading branch information
lovable-dev[bot] committed Dec 19, 2024
1 parent cd8b937 commit 12f8cde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
25 changes: 10 additions & 15 deletions src/components/landing/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ export const LoginForm = () => {
const [acceptedTerms, setAcceptedTerms] = useState(false)
const { toast } = useToast()

const handleSignUp = (e: React.FormEvent) => {
if (!acceptedTerms) {
e.preventDefault()
toast({
variant: "destructive",
title: "Conditions d'utilisation",
description: "Veuillez accepter les conditions d'utilisation pour continuer.",
})
return false
}
return true
}

return (
<>
<DialogHeader>
Expand Down Expand Up @@ -86,14 +73,22 @@ export const LoginForm = () => {
order: 1,
},
}}
onSubmit={handleSignUp}
/>
<div className="mt-4 space-y-4">
<div className="flex items-start space-x-2">
<Checkbox
id="terms"
checked={acceptedTerms}
onCheckedChange={(checked) => setAcceptedTerms(checked as boolean)}
onCheckedChange={(checked) => {
setAcceptedTerms(checked as boolean)
if (!checked) {
toast({
variant: "destructive",
title: "Conditions d'utilisation",
description: "Veuillez accepter les conditions d'utilisation pour continuer.",
})
}
}}
className="mt-1"
/>
<div className="grid gap-1.5 leading-none">
Expand Down
15 changes: 3 additions & 12 deletions src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Auth } from "@supabase/auth-ui-react"
import { ThemeSupa } from "@supabase/auth-ui-shared"
import { supabase } from "@/lib/supabase"
import { supabase } from "@/integrations/supabase/client"
import { useNavigate } from "react-router-dom"
import { useEffect } from "react"
import { useToast } from "@/components/ui/use-toast"
import { useToast } from "@/hooks/use-toast"

export default function Login() {
const navigate = useNavigate()
Expand Down Expand Up @@ -102,17 +102,8 @@ export default function Login() {
required: true,
},
}}
onError={(error) => {
toast({
variant: "destructive",
title: "Erreur",
description: error.message === "User already registered"
? "Cette adresse email est déjà utilisée. Veuillez vous connecter."
: "Une erreur est survenue. Veuillez réessayer.",
})
}}
/>
</div>
</div>
)
}
}

0 comments on commit 12f8cde

Please sign in to comment.