diff --git a/public/src/components/EventCreateForm/EventCreateForm.js b/public/src/components/EventCreateForm/EventCreateForm.js index f93f983..203ecbd 100644 --- a/public/src/components/EventCreateForm/EventCreateForm.js +++ b/public/src/components/EventCreateForm/EventCreateForm.js @@ -184,14 +184,12 @@ export class EventCreateForm { reader.readAsDataURL(file); } }); - console.log(eventData); if (eventData != null) { - console.log('editevent'); img.src = `${endpoint}/${eventData.image}`; img.width = fileInput.width; const submitButton = this.form.querySelector('.event-create-form__submit-btn'); submitButton.innerHTML = 'Сохранить'; - submitButton.addEventListener('click', (event) => handleCreateEventEdit(event, '/events/my', navigate)); + submitButton.addEventListener('click', (event) => handleCreateEventEdit(event, `events/${eventData.id}`)); const mapping = { title: 'eventNameEntry', image: 'imageInput', @@ -226,9 +224,8 @@ export class EventCreateForm { mock_data = { latitude: eventData.Latitude, longitude: eventData.Longitude, zoom: 17, needMark: true}; } else { - console.log('edeitdevent'); const submitButton = this.form.querySelector('.event-create-form__submit-btn'); - submitButton.addEventListener('click', (event) => handleCreateEventSubmit(event, '/events/my', navigate)); + submitButton.addEventListener('click', (event) => handleCreateEventSubmit(event, '/events/my')); } // Инициализация карты diff --git a/public/src/modules/handleEventsActions.js b/public/src/modules/handleEventsActions.js index 30d951e..e9b73c3 100644 --- a/public/src/modules/handleEventsActions.js +++ b/public/src/modules/handleEventsActions.js @@ -13,6 +13,7 @@ * @import {function} removeDangerous - Removes dangerous characters from a string */ import { isValidUsername, isValidPassword, isValidEmail, removeDangerous } from './FormValidation.js'; +import { navigate } from './router.js'; /** * Import the endpoint configuration from the config.js file * @import {string} endpoint - The API endpoint URL @@ -88,7 +89,7 @@ export async function loadEvent(eventId) { return; } -export async function handleCreateEventEdit(event, id, navigate) { +export async function handleCreateEventEdit(event, id) { event.preventDefault(); loadCategories(); // Get form data @@ -147,7 +148,7 @@ export async function handleCreateEventEdit(event, id, navigate) { //navigate(pageToCome); //debug } -export async function handleCreateEventSubmit(event, pageToCome, navigate) { +export async function handleCreateEventSubmit(event, pageToCome) { event.preventDefault(); loadCategories(); // Get form data