Skip to content

Commit

Permalink
A
Browse files Browse the repository at this point in the history
  • Loading branch information
nowrobin committed Jul 14, 2024
1 parent 1892b0d commit f14a8fd
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 42 deletions.
25 changes: 12 additions & 13 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ NEXT_PUBLIC_SUPABASE_URL="https://ofytfuhgugaqsahbrrxs.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9meXRmdWhndWdhcXNhaGJycnhzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTk5OTI2MjYsImV4cCI6MjAzNTU2ODYyNn0.uCgT44A55ijDC0PrhkNs-kFGwKBb3bfbSWu69kAayTc"


POSTGRES_URL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require"
POSTGRES_PRISMA_URL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require&pgbouncer=true&connect_timeout=15"
POSTGRES_URL_NO_SSL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb"
POSTGRES_URL_NON_POOLING="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require"
POSTGRES_USER="default"
POSTGRES_HOST="ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech"
POSTGRES_PASSWORD="rp8vylxaqKO1"
POSTGRES_DATABASE="verceldb"
# POSTGRES_URL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require"
# POSTGRES_PRISMA_URL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require&pgbouncer=true&connect_timeout=15"
# POSTGRES_URL_NO_SSL="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech:5432/verceldb"
# POSTGRES_URL_NON_POOLING="postgres://default:rp8vylxaqKO1@ep-crimson-haze-a1r4iuxg.ap-southeast-1.aws.neon.tech:5432/verceldb?sslmode=require"
# POSTGRES_USER="default"
# POSTGRES_HOST="ep-crimson-haze-a1r4iuxg-pooler.ap-southeast-1.aws.neon.tech"
# POSTGRES_PASSWORD="rp8vylxaqKO1"
# POSTGRES_DATABASE="verceldb"




GOOGLE_CLIENT_ID="856852514692-3bntvuduhn28in4lss3dr1cu358hfmbi.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="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"
# GOOGLE_CLIENT_ID="856852514692-3bntvuduhn28in4lss3dr1cu358hfmbi.apps.googleusercontent.com"
# GOOGLE_CLIENT_SECRET="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"

GOOGLE_CLIENT_ID_DEV="856852514692-cc7ouompuehfk55dsknjal9312f3kp33.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET_DEV="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"
# GOOGLE_CLIENT_ID_DEV="856852514692-cc7ouompuehfk55dsknjal9312f3kp33.apps.googleusercontent.com"
# GOOGLE_CLIENT_SECRET_DEV="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"


NEXTAUTH_URL="http://localhost:3000"
Expand Down
11 changes: 3 additions & 8 deletions src/app/api/quote/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import prisma from "@/app/lib/prisma";
import { NextRequest } from "next/server";

export async function GET() {
// const quotes = await prisma.quote.findMany({
// orderBy: [
// {
// id: "asc",
// },
// ],
// });
const quote = await prisma.quote.findUnique({
where: {
id: 1,
Expand All @@ -21,14 +14,16 @@ export async function GET() {

export async function PUT(req: NextRequest) {
const { userId, quoteId } = await req.json();
if (userId === null || userId == undefined)
throw new Error("Not Authenticated");
const updateQuote = await prisma.quote.update({
where: {
id: quoteId,
},
data: {
User_Quote_liked_userIdToUser: {
connect: {
id: 1,
auth_id: userId,
},
},
},
Expand Down
15 changes: 15 additions & 0 deletions src/app/api/quoteList/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use server";

import prisma from "@/app/lib/prisma";
import { NextRequest } from "next/server";

export async function GET() {
const quotes = await prisma.quote.findMany({
orderBy: [
{
id: "asc",
},
],
});
return Response.json({ message: "success", data: quotes }, { status: 200 });
}
2 changes: 1 addition & 1 deletion src/app/login/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function googleLogin() {
queryParams: {
access_type: "offline",
prompt: "consent",
redirectTo: `http://localhost:3000/auth/callback`,
redirectTo: `/`,
},
},
});
Expand Down
34 changes: 17 additions & 17 deletions src/app/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// import { type NextRequest } from "next/server";
// import { updateSession } from "@/app/utils/supabase/middleware";
import { type NextRequest } from "next/server";
import { updateSession } from "@/app/utils/supabase/middleware";

// export async function middleware(request: NextRequest) {
// return await updateSession(request);
// }
export async function middleware(request: NextRequest) {
return await updateSession(request);
}

// export const config = {
// matcher: [
// /*
// * Match all request paths except for the ones starting with:
// * - _next/static (static files)
// * - _next/image (image optimization files)
// * - favicon.ico (favicon file)
// * Feel free to modify this pattern to include more paths.
// */
// "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
// ],
// };
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* Feel free to modify this pattern to include more paths.
*/
"/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
],
};
5 changes: 2 additions & 3 deletions src/app/quoteList/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ export default function QuoteList() {
const supabase = createClient();
await supabase.auth.getUser().then((value) => {
if (value.data.user) {
console.log(value.data.user.user_metadata);
setUser(value.data.user.user_metadata);
setUser(value.data.user);
}
});
}
getUserData();
}, []);
console.log(quote, user);
console.log(user);
let a = "";
if (quote) {
a = quote.content;
Expand Down

0 comments on commit f14a8fd

Please sign in to comment.