redirect to customer list after creating a new customer, not edit page

This commit is contained in:
2026-07-16 18:01:06 -04:00
parent ac6f9ff6a3
commit b8e28e3f1a
+3 -5
View File
@@ -30,13 +30,11 @@ router.post('/new', (req, res) => {
const name = (b.name || '').trim();
if (!name) return res.status(400).send('Name is required');
const info = db
.prepare(
db.prepare(
`INSERT INTO customers
(name, phone, alt_phone, email, address_line1, address_line2, city, state, zip, internal_note)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
)
.run(
).run(
name,
formatPhone(b.phone),
formatPhone(b.alt_phone),
@@ -49,7 +47,7 @@ router.post('/new', (req, res) => {
b.internal_note || null
);
res.redirect(303, `/customers/${info.lastInsertRowid}/edit`);
res.redirect(303, '/customers');
});
router.get('/:id/edit', (req, res) => {