Fix 404 on maintenance update: use url_for instead of hardcoded path
Hardcoded '/maintenance/{id}/update' ignored the '/itassets/' nginx prefix.
Generate the base URL with url_for and replace the placeholder id in JS.
This commit is contained in:
@@ -261,8 +261,9 @@ const form = document.getElementById('maintenanceForm');
|
||||
const titleText = document.getElementById('modalTitleText');
|
||||
const submitText = document.getElementById('submitBtnText');
|
||||
|
||||
const createUrl = "{{ url_for('maintenance.create') }}";
|
||||
const updateUrl = (id) => `/maintenance/${id}/update`;
|
||||
const createUrl = "{{ url_for('maintenance.create') }}";
|
||||
const _updateBase = "{{ url_for('maintenance.update', record_id=0) }}";
|
||||
const updateUrl = (id) => _updateBase.replace('/0/', `/${id}/`);
|
||||
|
||||
// ── Open for EDIT when a table row is clicked ────────────────────────────────
|
||||
document.querySelectorAll('tr[data-id]').forEach(row => {
|
||||
|
||||
Reference in New Issue
Block a user