Skip to content

Commit

Permalink
es-lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Oct 3, 2023
1 parent 3537aa5 commit d1c7ca8
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion _dev/js/theme/components/http/useDefaultHttpRequest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useHttpRequest from './useHttpRequest';
import GenericHttpRequestError from "./error/GenericHttpRequestError";
import GenericHttpRequestError from './error/GenericHttpRequestError';

/**
* Default http request accepting payload as object and returning promise with response
Expand Down
2 changes: 1 addition & 1 deletion _dev/js/theme/core/cart/handler/cart/addToCartHandler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prestashop from 'prestashop';
import useAlertToast from '../../../../components/useAlertToast';
import addToCartRequest from '../../request/cart/addToCartRequest';
import sprintf from '../../../../utils/sprintf';
import prestashop from "prestashop";

const { danger } = useAlertToast();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prestashop from 'prestashop';
import deleteFromCartRequest from '../../request/cart/deleteFromCartRequest';
import prestashop from "prestashop";

/**
* Delete product from cart handler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prestashop from 'prestashop';
import deleteVoucherFromCartRequest from '../../request/voucher/deleteVoucherFromCartRequest';
import prestashop from "prestashop";

/**
* Delete voucher handler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prestashop from 'prestashop';
import addVoucherToCartRequest from '../../request/voucher/addVoucherToCartRequest';
import parseToHtml from '../../../../utils/parseToHtml';
import prestashop from "prestashop";

/**
* Submit voucher handler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import prestashop from 'prestashop';
import { formSerializeArray, fromSerializeObject } from '../../../../utils/formSerialize';
import selectDeliveryMethodRequest from '../../request/selectDeliveryMethodRequest';
import parseToHtml from '../../../../utils/parseToHtml';
import refreshCheckoutPage from '../../utils/refreshCheckoutPage';
import { each } from '../../../../utils/DOMHelpers';
import prestashop from "prestashop";

/**
* Change delivery method handler
Expand Down
3 changes: 0 additions & 3 deletions _dev/js/theme/core/listing/handler/updateFacetsHandler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import prestashop from 'prestashop';
import updateListingFacetsRequest from '../request/updateListingFacetsRequest';
import useAlertToast from '../../../components/useAlertToast';

const { danger } = useAlertToast();

/**
* Build new facets url - add from-xhr param
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useHttpRequest from '../../../components/http/useHttpRequest';
import useHttpController from '../../../components/http/useHttpController';
import GenericHttpRequestError from "../../../components/http/error/GenericHttpRequestError";
import GenericHttpRequestError from '../../../components/http/error/GenericHttpRequestError';

const { dispatch, abortAll } = useHttpController();

Expand Down
2 changes: 1 addition & 1 deletion _dev/js/theme/core/selectors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prestashop from 'prestashop';
import DOMReady from "../utils/DOMReady";
import DOMReady from '../utils/DOMReady';

prestashop.selectors = {
quantityWanted: '#quantity_wanted',
Expand Down
14 changes: 7 additions & 7 deletions _dev/js/theme/handler/error/httpRequestErrorHandler.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import GenericHttpRequestError from "../../components/http/error/GenericHttpRequestError";
import useAlertToast from "../../components/useAlertToast";
import prestashop from 'prestashop';
import GenericHttpRequestError from '../../components/http/error/GenericHttpRequestError';
import useAlertToast from '../../components/useAlertToast';

const { danger } = useAlertToast();

const httpRequestErrorHandler = ({
resp = {},
error = null,
}) => {
resp = {},
error = null,
}) => {
if (error && error instanceof GenericHttpRequestError) {
danger(prestashop.t.alert.genericHttpError);
} else if (typeof resp.errors !== 'undefined') {
const errors = resp.errors;
const { errors } = resp;
const errorMessage = Array.isArray(errors) ? errors.join('\n') : errors;

danger(errorMessage);
}
}
};

export default httpRequestErrorHandler;
2 changes: 1 addition & 1 deletion _dev/js/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import '@js/theme/components/customer';
import '@js/theme/components/quickview';
import '@js/theme/components/product';
import '@js/theme/components/cart/block-cart';
import httpRequestErrorHandler from './handler/error/httpRequestErrorHandler';
/* eslint-enable */

import prestashop from 'prestashop';
Expand All @@ -31,6 +30,7 @@ import TopMenu from '@js/theme/components/TopMenu';
import PageLazyLoad from '@js/theme/components/Lazyload';
import PageLoader from '@js/theme/components/PageLoader';
import useStickyElement from '@js/theme/components/useStickyElement';
import httpRequestErrorHandler from './handler/error/httpRequestErrorHandler';

prestashop.pageLazyLoad = new PageLazyLoad({
selector: '.lazyload',
Expand Down

0 comments on commit d1c7ca8

Please sign in to comment.