|
1 | 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ |
2 | | -import { login, getGoogleAuthUrl } from "@/services/authService"; |
| 2 | +import { login, getGoogleAuthUrl, getGithubAuthUrl } from "@/services/authService"; |
3 | 3 | import { Image } from "@unpic/react"; |
4 | 4 | import { motion } from "framer-motion"; |
5 | 5 | import { ArrowLeft, Eye, EyeOff } from "lucide-react"; |
@@ -67,6 +67,18 @@ export default function RightSide() { |
67 | 67 | } |
68 | 68 | }; |
69 | 69 |
|
| 70 | + const handleGithubLogin = async () => { |
| 71 | + setIsLoading(true); |
| 72 | + setApiError(""); |
| 73 | + try { |
| 74 | + const url = await getGithubAuthUrl(); |
| 75 | + window.location.href = url; |
| 76 | + } catch (err: any) { |
| 77 | + setApiError(err.message || "Erro ao iniciar login com Github."); |
| 78 | + setIsLoading(false); |
| 79 | + } |
| 80 | + }; |
| 81 | + |
70 | 82 | const handleRevealPassword = () => setShowPassword((prev) => !prev); |
71 | 83 |
|
72 | 84 | const handleSubmit = async (e: FormEvent) => { |
@@ -236,9 +248,9 @@ export default function RightSide() { |
236 | 248 | <button type="button" disabled={isLoading} className="flex justify-center items-center py-3 px-4 border border-gray-200 dark:border-neutral-800 rounded-xl bg-white/50 dark:bg-neutral-800/50 hover:bg-gray-50 dark:hover:bg-neutral-700/50 transition-all shadow-sm cursor-pointer disabled:opacity-50"> |
237 | 249 | <Image src="/facebook.png" alt="Facebook" width={20} height={20} className="object-contain" /> |
238 | 250 | </button> |
239 | | - <button type="button" disabled={isLoading} className="flex justify-center items-center py-3 px-4 border border-gray-200 dark:border-neutral-800 rounded-xl bg-white/50 dark:bg-neutral-800/50 hover:bg-gray-50 dark:hover:bg-neutral-700/50 transition-all shadow-sm cursor-pointer disabled:opacity-50"> |
| 251 | + <button type="button" onClick={handleGithubLogin} disabled={isLoading} className="flex justify-center items-center py-3 px-4 border border-gray-200 dark:border-neutral-800 rounded-xl bg-white/50 dark:bg-neutral-800/50 hover:bg-gray-50 dark:hover:bg-neutral-700/50 transition-all shadow-sm cursor-pointer disabled:opacity-50"> |
240 | 252 | <svg className="h-5 w-5 fill-gray-900 dark:fill-white transition-colors" viewBox="0 0 24 24"> |
241 | | - <path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M15.97 4.17c.66-.81 1.11-1.93.99-3.06-1 .04-2.21.67-2.93 1.49-.62.69-1.16 1.84-1.01 2.96 1.12.09 2.27-.58 2.95-1.39z" /> |
| 253 | + <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /> |
242 | 254 | </svg> |
243 | 255 | </button> |
244 | 256 | </div> |
|
0 commit comments