From 84a83e67388b4ee83778470cad4b6e00a125ff10 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Wed, 6 Sep 2023 16:38:46 +0800 Subject: [PATCH] refactor(utils): refactor to return error messages --- src/layouts/EditHomepage/EditHomepage.jsx | 15 +++++- src/layouts/EditHomepage/utils.ts | 62 +++++++++++++---------- 2 files changed, 48 insertions(+), 29 deletions(-) diff --git a/src/layouts/EditHomepage/EditHomepage.jsx b/src/layouts/EditHomepage/EditHomepage.jsx index 538c8ac70..e45ace788 100644 --- a/src/layouts/EditHomepage/EditHomepage.jsx +++ b/src/layouts/EditHomepage/EditHomepage.jsx @@ -56,7 +56,7 @@ import { RESOURCES_SECTION, } from "./constants" import { HomepagePreview } from "./HomepagePreview" -import { getDefaultValues, getHasErrorFromHomepageState } from "./utils" +import { getDefaultValues, getErrorsFromHomepageState } from "./utils" /* eslint-disable react/no-array-index-key */ @@ -160,6 +160,7 @@ const EditHomepage = ({ match }) => { setDisplayHighlights(displayHighlights) } const heroSection = frontMatter.sections.filter((section) => !!section.hero) + const errorMessages = getErrorsFromHomepageState(homepageState) const errorToast = useErrorToast() @@ -1092,8 +1093,18 @@ const EditHomepage = ({ match }) => { />