fix(payments): prepend synced rows instead of full page reload

PayPal sync route now returns the inserted rows; the client prepends
them (mirrors handleLogCash) instead of window.location.reload(),
preserving scroll/filter state. Was the only full reload in the app.
This commit is contained in:
Moheeb Zara
2026-05-17 01:18:05 -07:00
parent 7054b35ddb
commit 521fb1f8a8
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ export async function POST(req: NextRequest) {
.select()
if (insertError) throw new Error(insertError.message)
return NextResponse.json({ imported: imported?.length ?? newRows.length })
return NextResponse.json({ imported: imported?.length ?? newRows.length, rows: imported ?? [] })
} catch (err: any) {
console.error('[PayPal sync error]', err)
return NextResponse.json({ error: err.message ?? 'Sync failed' }, { status: 500 })