remove update-session route

This commit is contained in:
Shreyaschorge 2025-07-16 23:03:01 +05:30
parent 8124fe5f6c
commit ebb8068ade
No known key found for this signature in database
2 changed files with 0 additions and 56 deletions

View File

@ -714,16 +714,6 @@ export async function init(projectName = null, autoAcceptDefaults = false, apiKe
}
}
const updateSessionRoutePath = path.join(projectPath, 'src', 'app', 'api', 'auth', 'update-session', 'route.ts');
if (fs.existsSync(updateSessionRoutePath)) {
fs.rmSync(updateSessionRoutePath, { force: true });
// Remove the directory if it's empty
const updateSessionDir = path.dirname(updateSessionRoutePath);
if (fs.readdirSync(updateSessionDir).length === 0) {
fs.rmSync(updateSessionDir, { recursive: true, force: true });
}
}
// Remove src/auth.ts file
const authFilePath = path.join(projectPath, 'src', 'auth.ts');
if (fs.existsSync(authFilePath)) {

View File

@ -1,46 +0,0 @@
import { NextResponse } from 'next/server';
import { getServerSession } from 'next-auth';
import { authOptions } from '~/auth';
export async function POST(request: Request) {
try {
const session = await getServerSession(authOptions);
if (!session?.user?.fid) {
return NextResponse.json(
{ error: 'No authenticated session found' },
{ status: 401 }
);
}
const body = await request.json();
const { signers, user } = body;
if (!signers || !user) {
return NextResponse.json(
{ error: 'Signers and user are required' },
{ status: 400 }
);
}
// For NextAuth to update the session, we need to trigger the JWT callback
// This is typically done by calling the session endpoint with updated data
// However, we can't directly modify the session token from here
// Instead, we'll store the data temporarily and let the client refresh the session
// The session will be updated when the JWT callback is triggered
return NextResponse.json({
success: true,
message: 'Session update prepared',
signers,
user,
});
} catch (error) {
console.error('Error preparing session update:', error);
return NextResponse.json(
{ error: 'Failed to prepare session update' },
{ status: 500 }
);
}
}