message: keep modal open on error, utilize useEffect
diff: @@ -110,7 +110,11 @@ const CssTemplateModal: FunctionComponent<CssTemplateModalProps> = ({
  const update_id = currentCssTemplate.id;
  delete currentCssTemplate.id;
  delete currentCssTemplate.created_by;
  - updateResource(update_id, currentCssTemplate).then(() => {
  + updateResource(update_id, currentCssTemplate).then(response => {
  + if (!response) {
  + return;
  + }
  +
  if (onCssTemplateAdd) {
  onCssTemplateAdd();
  }
  @@ -120,7 +124,11 @@ const CssTemplateModal: FunctionComponent<CssTemplateModalProps> = ({
  }
  } else if (currentCssTemplate) {
  // Create
  - createResource(currentCssTemplate).then(() => {
  + createResource(currentCssTemplate).then(response => {
  + if (!response) {
  + return;
  + }
  +
  if (onCssTemplateAdd) {
  onCssTemplateAdd();
  }
  @@ -166,6 +174,7 @@ const CssTemplateModal: FunctionComponent<CssTemplateModalProps> = ({
  };
  // Initialize
  + useEffect(() => {
  if (
  isEditMode &&
  (!currentCssTemplate ||
  @@ -176,9 +185,7 @@ const CssTemplateModal: FunctionComponent<CssTemplateModalProps> = ({
  if (cssTemplate && cssTemplate.id !== null && !loading) {
  const id = cssTemplate.id || 0;
  - fetchResource(id).then(() => {
  - setCurrentCssTemplate(resource);
  - });
  + fetchResource(id);
  }
  } else if (
  !isEditMode &&
  @@ -189,6 +196,13 @@ const CssTemplateModal: FunctionComponent<CssTemplateModalProps> = ({
  css: '',
  });
  }
  + }, [cssTemplate]);
  +
  + useEffect(() => {
  + if (resource) {
  + setCurrentCssTemplate(resource);
  + }
  + }, [resource]);
  // Validation
  useEffect(() => {
  