Skip to content

Commit

Permalink
Removed old auth stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-rt committed Jan 23, 2025
1 parent 9362a78 commit 6c88419
Show file tree
Hide file tree
Showing 6 changed files with 1,185 additions and 1,423 deletions.
16 changes: 1 addition & 15 deletions frontend/review-nextjs/app/(header)/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
"use client";
import Skeleton from "@/components/Skeleton";
import { userManager } from "@/lib/auth";
import { useEffect } from "react";
import { AuthProvider, AuthProviderProps, useAuth } from "react-oidc-context";
import { permanentRedirect } from "next/navigation";

const config = {
userManager,
onSigninCallback: (user) => {
console.log(user);
permanentRedirect("/review");
},
} satisfies AuthProviderProps;

export default function AuthLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return <AuthProvider {...config}>{children}</AuthProvider>;
return children;
}
23 changes: 4 additions & 19 deletions frontend/review-nextjs/app/(header)/(auth)/review/page.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
"use client";
import Skeleton from "@/components/Skeleton";
import { cn } from "@/lib/utils";
import { useEffect } from "react";
import { useAuth } from "react-oidc-context";

/*
On error with fetching data
try {
userManager.signinSilent()
} catch (error) {
userManager.signinRedirect()
}
*/

export default function Review() {
const auth = useAuth();

return (
<div id="review" className={cn("mx-[20%]")}>
{auth.isLoading ? <Skeleton /> : <ReviewPage />}
{/* {auth.isLoading ? <Skeleton /> : <ReviewPage />} */}
</div>
);
}

function ReviewPage() {
const auth = useAuth();

return (
<p>
Secret data that needs authentication {auth.isAuthenticated}{" "}
{auth.user?.profile.email}
Secret data
{/* Secret data that needs authentication {auth.isAuthenticated}{" "} */}
{/* {auth.user?.profile.email} */}
</p>
);
}
23 changes: 0 additions & 23 deletions frontend/review-nextjs/lib/auth.ts

This file was deleted.

15 changes: 7 additions & 8 deletions frontend/review-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@
"lint": "next lint"
},
"dependencies": {
"@tailwindcss/postcss": "^4.0.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.454.0",
"lucide-react": "^0.474.0",
"next": "^15.0.2",
"oidc-client-ts": "^3.1.0",
"react": "^18",
"react-dom": "^18",
"react-oidc-context": "^3.2.0",
"react": "^19",
"react-dom": "^19",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@types/node": "^22",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.0.2",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"tailwindcss": "^4.0.0",
"typescript": "^5"
}
}
6 changes: 3 additions & 3 deletions frontend/review-nextjs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
plugins: {
"@tailwindcss/postcss": {},
},
};

export default config;
Loading

0 comments on commit 6c88419

Please sign in to comment.