Skip to content

Commit

Permalink
fixed login in landing page?
Browse files Browse the repository at this point in the history
  • Loading branch information
chuma-beep committed Dec 30, 2024
1 parent cb10d09 commit 9147e75
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 50 deletions.
41 changes: 0 additions & 41 deletions app/auth/callback/route.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
// import { NextResponse } from 'next/server';
// import { createClient } from '@/utils/supabase/server';

// export async function GET(request: Request) {
// const { searchParams, origin } = new URL(request.url);
// const code = searchParams.get('code');
// const next = searchParams.get('next') ?? '/protected';

// const supabase = createClient();
// const { data: { session } } = await supabase.auth.getSession();


// // If the user is authenticated, redirect to the /protected route
// if (session) {
// return NextResponse.redirect(`${origin}/protected`);
// }

// // Handle the OAuth callback by exchanging the code for a session
// if (code) {
// const { error } = await supabase.auth.exchangeCodeForSession(code);
// if (!error) {
// const forwardedHost = request.headers.get('x-forwarded-host');
// const isLocalEnv = process.env.NODE_ENV === 'development';

// if (isLocalEnv) {
// return NextResponse.redirect(`${origin}/protected`);
// } else if (forwardedHost) {
// return NextResponse.redirect(`https://${forwardedHost}${next}`);
// } else {
// // return NextResponse.redirect(`${origin}${next}`);
// return NextResponse.redirect(`${origin}/protected`);
// }
// }
// }

// // If the code is missing or there was an error, redirect to an error page
// return NextResponse.redirect(`${origin}/auth/auth-code-error`);
// }



import { NextResponse } from 'next/server';
import { createClient } from '@/utils/supabase/server';

Expand Down
1 change: 1 addition & 0 deletions app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { encodedRedirect } from "@/utils/utils";
import GithubAuthenticate from "./github/GithubAuth";
import GoogleAuthenticate from "./google/GoogleAuthButton";
import Image from "next/image";
import { useSession } from 'next-auth/react'



Expand Down
7 changes: 0 additions & 7 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
"use client";

import HomeButton from "../components/LogoButton";
import AuthButton from "../components/AuthButton";
import MainFooter from "@/components/main-footer";
import { WriteIcon } from "@/components/WriteIcon";
import Search from "@/components/Search/Search";
import { ModeToggle } from "@/components/toggle-theme";
import * as Tooltip from "@radix-ui/react-tooltip";
import LandingPage from "../components/LandingPage";

export default function Index() {
Expand Down
12 changes: 10 additions & 2 deletions components/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as Tooltip from "@radix-ui/react-tooltip";
import { Button } from "./ui/button";
import CommunityIcon from "../components/CommunityIcon"
import { BiDownArrow } from "react-icons/bi";
import Link from "next/link";



Expand Down Expand Up @@ -207,8 +208,15 @@ export default function LandingPage() {
<span className="relative z-10 block px-6 py-3 rounded-xl bg-blue-800">
<div className="relative z-10 flex items-center space-x-2">
<span className="transition-all duration-500 group-hover:translate-x-1"
>Let's get started</span
>
>
<Link
// href="/login"
href={'/login'}
>

Let's get started
</Link>
</span>
<svg
className="w-6 h-6 transition-transform duration-500 group-hover:translate-x-1"
data-slot="icon"
Expand Down
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"marked": "^14.1.3",
"motion": "^11.15.0",
"next": "latest",
"next-auth": "^4.24.11",
"next-themes": "^0.3.0",
"postcss": "8.4.33",
"react": "^18.2.0",
Expand Down

0 comments on commit 9147e75

Please sign in to comment.