redirect to customer list after creating a new customer, not edit page
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user