-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feat/toast notification errors #281
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds error toast notifications when the api call to save or delete an image or file fails.
This commit adds error toast notifications when the api call to save a repo's setting config fails.
This commit adds error toast notifications when the api call to rename or to delete a folder (collection or resource category) fails
This commit adds error toast notifications when the api call to delete or to move a page (normal page, collection page, or resource page) fails
This commit adds error toast notifications when the ComponentSettingsModal tries but fails to retrieve page setting information. It also modifies the component so that an error toast is displayed when the api call to save page settings or to delete the page fails.
This commit adds an error toast when we fail to retrieve third nav options in the ComponentSettingsModal
This commit adds error toasts when the api calls to save EditHomepage fails, or when the api calls to save or delete the EditPage fails.
When handling errors in some cases, we attempt to check for a http error response status. However, since the error might not come from a http error, the `status` attribute might not be present in the error object, which leads to an undefined attribute exception. This commit fixes that bug by using optional chaining.
This commit modifies all applicable existing usage of the Toast component to use the default error toast message that is now defined as a constant in the main utils file. This is so that if we need to reword our error message, we only need to do it in one place, instead of in every single file.
alexanderleegs
approved these changes
Dec 4, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This was referenced Dec 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR resolves issue #279 by rendering error toast notifications, which first appeared in #247, when a user-triggered API call fails. The error toasts serve as a form of feedback to let the user know that their action has failed and informs them of other possible actions they could take (reload the page, check internet connection etc.).
Previously, we displayed error toasts when a user attempted to create/save a file but there already existed another file with the same file name (PR #247). This PR expands on that to display error toasts for all errors, not just for the cases where there is a file name conflict.
This PR also performs a minor bug fix where we attempt to access the
status
attribute of an error (err.response.status
) in an attempt to display an error toast. Thisstatus
attribute might not exist if the error object is not an HTTP error, which leads to an undefined attribute exception. This is resolved by using optional chaining.The following list identifies the components and operations where the error toast notification gets displayed.
Components
ComponentSettingsModal
FolderCard
FolderModal
MediaSettingsModal
OverviewCard
Layouts
EditHomepage
EditPage
Settings