Skip to content

Commit

Permalink
名前を修正したらユーザ情報を読み込み直すように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nose221834 committed Nov 16, 2024
1 parent a28a7bc commit 9b12a11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/app/api/user/rename/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use server";

import { prisma } from "@lib/prisma";
import { revalidatePath } from "next/cache";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";


export async function PUT(req: NextRequest) {
const { pathname } = new URL(req.url || "");
const id = Number(pathname.split("/").pop());
Expand All @@ -28,6 +30,8 @@ export async function PUT(req: NextRequest) {
data: { name : name },
});

revalidatePath("/api/user");

return NextResponse.json({ putName }, { status: 200 });
} catch (error) {
return NextResponse.json(
Expand Down

0 comments on commit 9b12a11

Please sign in to comment.