Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/dashboard/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function DashboardContent({ authUser }: any) {
return (
<main className="container mx-auto space-y-6">
<h1 className="text-3xl font-bold">Welcome, {authUser?.fullName}</h1>
<Card>
<Card className="bg-secondary">
<CardHeader>
<CardTitle>Your Profile</CardTitle>
</CardHeader>
Expand Down Expand Up @@ -75,7 +75,7 @@ export default function Dashboard() {
<>
<DashboardContent authUser={authUser} />
{leetcodeStats && (
<div className="container mx-auto bg-neutral-800 rounded-lg p-3 mt-6">
<div className="container mx-auto bg-secondary rounded-lg p-3 mt-6">
<h2 className="text-xl font-semibold mb-4">Your LeetCode Progress</h2>
<div className="max-w-xl">
<Bar data={chartData} />
Expand Down
7 changes: 3 additions & 4 deletions components/dashboardComponents/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { SidebarData } from "@/data/SidebarData";
import { supabase } from "@/lib/supabaseClient";
import { signout } from "@/app/actions/action";

export function AppSidebar() {
const { setTheme, theme } = useTheme();
Expand All @@ -24,13 +25,11 @@ export function AppSidebar() {
const [isCollapsed, setIsCollapsed] = React.useState(false);
const handleLogout = async () => {
try {
const { error } = await supabase.auth.signOut();
if (error) throw error;
signout();
router.push('/auth/signin');
} catch (error) {
console.error("Sign out error:", error);
}
// Fix the Logout functionality, something is wrong here, It keeps throwing a 307 error on logout,and the user is not redirected to the login page
}
};

return (
Expand Down
13 changes: 11 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@radix-ui/react-tooltip": "^1.1.6",
"@supabase/ssr": "^0.5.2",
"@types/bcryptjs": "^2.4.6",
"@types/express": "^5.0.0",
"@types/react-chartjs-2": "^2.0.2",
"axios": "^1.7.9",
"bcryptjs": "^2.4.3",
Expand All @@ -49,6 +48,7 @@
"@eslint/eslintrc": "^3",
"@supabase/auth-helpers-nextjs": "^0.10.0",
"@supabase/supabase-js": "^2.47.11",
"@types/express": "^5.0.0",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
Expand Down
9 changes: 9 additions & 0 deletions utils/supabase/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export async function updateSession(request: NextRequest) {
// return NextResponse.redirect(url)
// }

//if no user and user try to hit any route other than /auth/signin or /auth/signup or /, redirect to /auth/signin
if (!user && !request.nextUrl.pathname.startsWith('/auth/signin') && !request.nextUrl.pathname.startsWith('/auth/signup') && request.nextUrl.pathname !== '/') {
const url = request.nextUrl.clone()
url.pathname = '/auth/signin'
return NextResponse.redirect(url)
}



if (
user &&
(request.nextUrl.pathname === '/' ||
Expand Down
Loading