Skip to content

Commit

Permalink
refactor: Apply changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
petesfrench committed Nov 8, 2024
1 parent 67c6233 commit 2789ee4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions static/js/src/authors-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const updateQueryParams = document.querySelector('.js-asset-search');
(function () {
const authorsSearchComponent = document.querySelector('.js-authors-search');
if (authorsSearchComponent) {
authorsSearchComponent?.addEventListener('focusin', function (e) {
authorsSearchComponent.addEventListener('focusin', function () {
openPanel(authorsSearchComponent, true, 'focusin');
});
authorsSearchComponent.addEventListener('focusout', function (e) {
Expand Down Expand Up @@ -45,8 +45,6 @@ function setUpAuthorSearchField() {
if (response.ok) {
const data = await response.json();
updateSearchResults(data);
} else {
console.log("No user found");
}
} catch (error) {
console.error('Error fetching user data:', error);
Expand All @@ -73,7 +71,7 @@ export default function handleAuthorsChip(targetChip) {

/*
* Adds and removes the author chips to the search panel.
* As this comes from an API call, we can not setupo the chips on load (like with products).
* As this comes from an API call, we can not setup the chips on load (like with products).
* We have to create the chips on the fly. Limited to 10 results.
* @param {Array} data - The data from the API call.
**/
Expand Down
2 changes: 1 addition & 1 deletion static/js/src/date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ document.addEventListener("DOMContentLoaded", function () {
flatpickr(".js-date-picker", {
mode: "range",
dateFormat: "Y-m-d",
onChange: function(selectedDates, dateStr, instance) {
onChange: function(selectedDates) {
const [startDate, endDate] = selectedDates;
if (startDate) {
addValueToHiddenInput(startDate.toISOString(), document.querySelector(".js-hidden-field-startdate"), replace = true);
Expand Down
4 changes: 2 additions & 2 deletions static/js/src/generic-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function handleSelectInputs() {
*/
function handleTagInput() {
const tagsInput = document.querySelector('.js-tags');
tagsInput?.addEventListener('input', function(e) {
tagsInput?.addEventListener('input', function() {
addValueToQueryParams(tagsInput.name, tagsInput.value, replace = true);
});
}
Expand All @@ -49,7 +49,7 @@ function handleTagInput() {
*/
function handleSalesforceIdInput() {
const salesforceIdInput = document.querySelector('.js-salesforce-campaign-id');
salesforceIdInput?.addEventListener('input', function(e) {
salesforceIdInput?.addEventListener('input', function() {
addValueToQueryParams(salesforceIdInput.name, salesforceIdInput.value, replace = true);
});
}
Expand Down

0 comments on commit 2789ee4

Please sign in to comment.