rig route fix
This commit is contained in:
parent
37d474d7c8
commit
58ef1b62b4
1 changed files with 4 additions and 6 deletions
|
|
@ -12,12 +12,11 @@ async function bearerFromCookies() {
|
|||
return `Bearer ${at}`;
|
||||
}
|
||||
|
||||
export async function PATCH(req: NextRequest, { params }: { params: { id?: string } }) {
|
||||
export async function PATCH(req: NextRequest, { params }: { params: { id: string } }) {
|
||||
try {
|
||||
const auth = await bearerFromCookies();
|
||||
const body = await req.json().catch(() => ({}));
|
||||
const id = params?.id;
|
||||
if (!id) return NextResponse.json({ error: "Missing id" }, { status: 400 });
|
||||
const id = params.id;
|
||||
|
||||
const data = await directusFetch<{ data: any }>(
|
||||
`/items/${BASE_COLLECTION}/${id}`,
|
||||
|
|
@ -40,11 +39,10 @@ export async function PATCH(req: NextRequest, { params }: { params: { id?: strin
|
|||
}
|
||||
}
|
||||
|
||||
export async function DELETE(_req: NextRequest, { params }: { params: { id?: string } }) {
|
||||
export async function DELETE(_req: NextRequest, { params }: { params: { id: string } }) {
|
||||
try {
|
||||
const auth = await bearerFromCookies();
|
||||
const id = params?.id;
|
||||
if (!id) return NextResponse.json({ error: "Missing id" }, { status: 400 });
|
||||
const id = params.id;
|
||||
|
||||
await directusFetch(`/items/${BASE_COLLECTION}/${id}`, {
|
||||
method: "DELETE",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue