Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the most inner nested function to outside to reduce number of nesting layers in file public/src/admin/dashboard/searches.js #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ChristinaTrinh
Copy link

@ChristinaTrinh ChristinaTrinh commented Jan 15, 2025

Since the number of nested functions exceed 4, specifically, the total was 5, I needed to move the function handleError outside and declared it using const.
The changes do not add more problems or errors to the code as I do npm run lint and npm run test.
I added two small test cases to check the expected behavior of handleError:
Test 1: Check that handleError correctly gives error message when there is an error
Test 2: Check that handleError gives undefined object when there is no error because of the default output of ajaxify
resolves #1

@ChristinaTrinh ChristinaTrinh changed the title Move the most inner nested function to outside to reduce number of nesting layers in file src/admin/dashboard/searches.js Move the most inner nested function to outside to reduce number of nesting layers in file public/src/admin/dashboard/searches.js Jan 15, 2025
@AZHenley AZHenley closed this Jan 21, 2025
@AZHenley AZHenley reopened this Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring code in public/src/admin/dashboard/searches.js
2 participants