Settings Page: Render SMTP port error (#4239)

This commit is contained in:
RachelElysia 2022-02-17 12:58:25 -05:00 committed by GitHub
parent 2cf1074bf9
commit 689de41878
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -0,0 +1 @@
* Render more helpful SMTP error when cannot configure SMTP server

View file

@ -58,9 +58,23 @@ const AppSettingsPage = (): JSX.Element => {
.then(() => {
dispatch(renderFlash("success", "Successfully updated settings."));
})
.catch((errors: any) => {
if (errors.base) {
dispatch(renderFlash("error", errors.base));
.catch((response: any) => {
if (
response.data.errors[0].reason.includes("could not dial smtp host")
) {
dispatch(
renderFlash(
"error",
"Could not connect to SMTP server. Please try again."
)
);
} else if (response.data.errors) {
dispatch(
renderFlash(
"error",
`Could not update settings. ${response.data.errors[0].reason}`
)
);
}
})
.finally(() => {