mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: prisma, postgresql, and upgrade to auth.js@beta
This commit is contained in:
parent
54fee71491
commit
7b799405dc
12 changed files with 720 additions and 147 deletions
|
|
@ -1,21 +1,3 @@
|
|||
import NextAuth from "next-auth";
|
||||
import Discord from "next-auth/providers/discord";
|
||||
import Github from "next-auth/providers/github";
|
||||
import { handlers } from "@/lib/auth";
|
||||
|
||||
const handler = NextAuth({
|
||||
pages: {
|
||||
signIn: "/login",
|
||||
},
|
||||
providers: [
|
||||
Discord({
|
||||
clientId: process.env.DISCORD_ID!,
|
||||
clientSecret: process.env.DISCORD_SECRET!,
|
||||
}),
|
||||
Github({
|
||||
clientId: process.env.GITHUB_ID!,
|
||||
clientSecret: process.env.GITHUB_SECRET!,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
export const { GET, POST } = handlers;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import Link from "next/link";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { Icon } from "@iconify/react";
|
||||
|
||||
import { auth } from "@/lib/auth";
|
||||
|
||||
import SearchBar from "./search-bar";
|
||||
import ProfileOverview from "./profile-overview";
|
||||
import LogoutButton from "./logout-button";
|
||||
|
||||
export default async function Header() {
|
||||
const session = await getServerSession();
|
||||
const session = await auth();
|
||||
|
||||
return (
|
||||
<div className="sticky top-0 z-50 w-full p-4 grid grid-cols-3 gap-2 gap-x-4 items-center bg-amber-50 border-b-4 border-amber-200 shadow-md max-lg:grid-cols-2 max-sm:grid-cols-1">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { getServerSession } from "next-auth";
|
||||
import { auth } from "@/lib/auth";
|
||||
|
||||
export default async function ProfileOverview() {
|
||||
const session = await getServerSession();
|
||||
const session = await auth();
|
||||
|
||||
return (
|
||||
<li title="Your profile">
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { getServerSession } from "next-auth";
|
||||
|
||||
import LoginButtons from "../components/login-buttons";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { auth } from "@/lib/auth";
|
||||
import LoginButtons from "../components/login-buttons";
|
||||
|
||||
export default async function LoginPage() {
|
||||
const session = await getServerSession();
|
||||
const session = await auth();
|
||||
|
||||
// If the user is already logged in, redirect
|
||||
if (session) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue