Skip to content

Commit

Permalink
apply "unicorn/prefer-at" rule fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 29, 2023
1 parent 9800839 commit 2455d38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/src/services/api.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class ApiService {
*/
showErrorModal(errorMsg) {
if (atk.modalService.modals.length > 0) {
const $modal = $(atk.modalService.modals[atk.modalService.modals.length - 1]);
const $modal = $(atk.modalService.modals.at(-1));
if ($modal.data('closeOnLoadingError')) {
$modal.removeData('closeOnLoadingError').modal('hide');
}
Expand Down
6 changes: 3 additions & 3 deletions js/src/services/modal.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ModalService {
onHide() {
const s = atk.modalService;

if (s.modals.length === 0 || s.modals[s.modals.length - 1] !== this) {
if (s.modals.length === 0 || s.modals.at(-1) !== this) {
throw new Error('Unexpected modal to hide - modal is not front');
}
s.modals.pop();
Expand All @@ -67,7 +67,7 @@ class ModalService {
addModal($modal) {
// hide other modals
if (this.modals.length > 1) {
const $prevModal = $(this.modals[this.modals.length - 2]);
const $prevModal = $(this.modals.at(-2));
if ($prevModal.hasClass('visible')) {
$prevModal.css('visibility', 'hidden');
$prevModal.addClass('__hiddenNotFront');
Expand Down Expand Up @@ -132,7 +132,7 @@ class ModalService {

// hide other modals
if (this.modals.length > 0) {
const $prevModal = $(this.modals[this.modals.length - 1]);
const $prevModal = $(this.modals.at(-1));
if ($prevModal.hasClass('__hiddenNotFront')) {
$prevModal.css('visibility', '');
$prevModal.addClass('visible');
Expand Down

0 comments on commit 2455d38

Please sign in to comment.