mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-15 15:48:56 -05:00
remove update-session route
This commit is contained in:
parent
8124fe5f6c
commit
ebb8068ade
10
bin/init.js
10
bin/init.js
@ -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)) {
|
||||
|
||||
@ -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 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user