Skip to content

Bsl 36 admin ad page#35

Open
Junny20 wants to merge 6 commits intomainfrom
bsl-36-admin-ad-page
Open

Bsl 36 admin ad page#35
Junny20 wants to merge 6 commits intomainfrom
bsl-36-admin-ad-page

Conversation

@Junny20
Copy link
Copy Markdown
Contributor

@Junny20 Junny20 commented Mar 6, 2026

No description provided.

@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to import NextRequest, auth, Role, Prisma... complete block something like this:

import { NextRequest, NextResponse } from "next/server";
import { Role, Prisma } from "@/generated/prisma/client";
import { prisma } from "@/lib/prisma";
import { auth } from "@/auth";

updatedAt: string;
}

export default function ApplicationDetail({ params }: { params: { id: string } }) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at this: https://nextjs.org/docs/app/api-reference/functions/use-params

I believe in nextjs 15 params is a Promise for both server and client components.. so if we are doing "use-client" we should import useParams from "next/navigation" and wrap id with useParams...

like this:

import { useParams } from "next/navigation";

export default function ApplicationDetail() {
  const { id } = useParams<{ id: string }>();

***then you would have to replace every params.id to just id (just one instance below)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should verify and look into this if necessary though.. I am a little confused myself which approach should be taken

setActioning(status);
setActionError(null);
try {
const res = await fetch(`/api/admin/applications/${params.id}`, {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off of the above comment about Futures.. if you go with the approach I mentioned above... this should be id not params.is

interface Application {
id: string;
type: string;
status: string;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you define type ApplicationStatus = "pending" | "approved" | "rejected"; in app/admin/applications/page.tsx

Not sure if you either wanted to move ApplicationStatus to a shared types file and import it... or use the union type here too like this: status: "pending" | "approved" | "rejected";

(Not necessary.. up to you)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants