nopaque/app/static/js/forms/create-job-form.js

21 lines
649 B
JavaScript

Forms.CreateJobForm = class CreateJobForm extends Forms.BaseForm {
static htmlClass = 'create-job-form';
constructor(formElement) {
super(formElement);
let versionField = this.formElement.querySelector('#create-job-form-version');
versionField.addEventListener('change', (event) => {
let url = new URL(window.location.href);
url.search = `?version=${event.target.value}`;
window.location.href = url.toString();
});
this.addEventListener('requestLoad', (event) => {
if (event.target.status === 201) {
window.location.href = event.target.getResponseHeader('Location');
}
});
}
};