Steven 4 سال پیش
والد
کامیت
6d0cdf86c4

+ 2 - 2
packages/app/src/components/Page.jsx

@@ -176,8 +176,8 @@ Page.propTypes = {
   isSlackEnabled: PropTypes.bool.isRequired,
   isSlackEnabled: PropTypes.bool.isRequired,
   slackChannels: PropTypes.string.isRequired,
   slackChannels: PropTypes.string.isRequired,
   grant: PropTypes.number.isRequired,
   grant: PropTypes.number.isRequired,
-  grantGroupId: PropTypes.string.isRequired,
-  grantGroupName: PropTypes.string.isRequired,
+  grantGroupId: PropTypes.string,
+  grantGroupName: PropTypes.string,
 };
 };
 
 
 const PageWrapper = (props) => {
 const PageWrapper = (props) => {

+ 2 - 2
packages/app/src/components/PageEditor.jsx

@@ -404,8 +404,8 @@ PageEditor.propTypes = {
   isSlackEnabled: PropTypes.bool.isRequired,
   isSlackEnabled: PropTypes.bool.isRequired,
   slackChannels: PropTypes.string.isRequired,
   slackChannels: PropTypes.string.isRequired,
   grant: PropTypes.number.isRequired,
   grant: PropTypes.number.isRequired,
-  grantGroupId: PropTypes.string.isRequired,
-  grantGroupName: PropTypes.string.isRequired,
+  grantGroupId: PropTypes.string,
+  grantGroupName: PropTypes.string,
 };
 };
 
 
 export default PageEditorWrapper;
 export default PageEditorWrapper;

+ 2 - 2
packages/app/src/components/PageEditorByHackmd.jsx

@@ -467,8 +467,8 @@ PageEditorByHackmd.propTypes = {
   isSlackEnabled: PropTypes.bool.isRequired,
   isSlackEnabled: PropTypes.bool.isRequired,
   slackChannels: PropTypes.string.isRequired,
   slackChannels: PropTypes.string.isRequired,
   grant: PropTypes.number.isRequired,
   grant: PropTypes.number.isRequired,
-  grantGroupId: PropTypes.string.isRequired,
-  grantGroupName: PropTypes.string.isRequired,
+  grantGroupId: PropTypes.string,
+  grantGroupName: PropTypes.string,
 };
 };
 
 
 export default withTranslation()(PageEditorByHackmdWrapper);
 export default withTranslation()(PageEditorByHackmdWrapper);

+ 12 - 9
packages/app/src/components/SavePageControls.jsx

@@ -44,10 +44,7 @@ class SavePageControls extends React.Component {
   }
   }
 
 
   updateGrantHandler(data) {
   updateGrantHandler(data) {
-    const { grant, grantGroupId, grantGroupName } = this.props;
-    const { mutate: mutateGrant } = grant;
-    const { mutate: mutateGrantGroupId } = grantGroupId;
-    const { mutate: mutateGrantGroupName } = grantGroupName;
+    const { mutateGrant, mutateGrantGroupId, mutateGrantGroupName } = this.props;
 
 
     mutateGrant(data.grant);
     mutateGrant(data.grant);
     mutateGrantGroupId(data.grantGroupId);
     mutateGrantGroupId(data.grantGroupId);
@@ -139,9 +136,9 @@ const SavePageControlsWrapper = (props) => {
   const { data: editorMode } = useEditorMode();
   const { data: editorMode } = useEditorMode();
   const { data: isSlackEnabled } = useIsSlackEnabled();
   const { data: isSlackEnabled } = useIsSlackEnabled();
   const { data: slackChannels } = useSlackChannels();
   const { data: slackChannels } = useSlackChannels();
-  const { data: grant } = useGrant();
-  const { data: grantGroupId } = useGrantGroupId();
-  const { data: grantGroupName } = useGrantGroupName();
+  const { data: grant, mutate: mutateGrant } = useGrant();
+  const { data: grantGroupId, mutate: mutateGrantGroupId } = useGrantGroupId();
+  const { data: grantGroupName, mutate: mutateGrantGroupName } = useGrantGroupName();
 
 
 
 
   if (isEditable == null || editorMode == null) {
   if (isEditable == null || editorMode == null) {
@@ -161,6 +158,9 @@ const SavePageControlsWrapper = (props) => {
       grant={grant}
       grant={grant}
       grantGroupId={grantGroupId}
       grantGroupId={grantGroupId}
       grantGroupName={grantGroupName}
       grantGroupName={grantGroupName}
+      mutateGrant={mutateGrant}
+      mutateGrantGroupId={mutateGrantGroupId}
+      mutateGrantGroupName={mutateGrantGroupName}
     />
     />
   );
   );
 };
 };
@@ -177,8 +177,11 @@ SavePageControls.propTypes = {
   isSlackEnabled: PropTypes.bool.isRequired,
   isSlackEnabled: PropTypes.bool.isRequired,
   slackChannels: PropTypes.string.isRequired,
   slackChannels: PropTypes.string.isRequired,
   grant: PropTypes.number.isRequired,
   grant: PropTypes.number.isRequired,
-  grantGroupId: PropTypes.string.isRequired,
-  grantGroupName: PropTypes.string.isRequired,
+  grantGroupId: PropTypes.string,
+  grantGroupName: PropTypes.string,
+  mutateGrant: PropTypes.func,
+  mutateGrantGroupId: PropTypes.func,
+  mutateGrantGroupName: PropTypes.func,
 };
 };
 
 
 export default withTranslation()(SavePageControlsWrapper);
 export default withTranslation()(SavePageControlsWrapper);