Conversation
| @@ -1,7 +1,7 @@ | |||
| import { NextResponse } from "next/server"; | |||
There was a problem hiding this comment.
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 } }) { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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}`, { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
No description provided.