|
@@ -1,6 +1,6 @@
|
|
|
import React, { useState, type FC, useCallback } from 'react';
|
|
import React, { useState, type FC, useCallback } from 'react';
|
|
|
|
|
|
|
|
-import { apiv3Post } from '~/client/util/apiv3-client';
|
|
|
|
|
|
|
+import { createPage } from '~/client/services/page-operation';
|
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
|
|
|
|
|
@@ -67,12 +67,12 @@ export const useNewPageInput = (): UseNewPageInput => {
|
|
|
|
|
|
|
|
setShowInput(false);
|
|
setShowInput(false);
|
|
|
|
|
|
|
|
- await apiv3Post('/page', {
|
|
|
|
|
|
|
+ await createPage({
|
|
|
path: newPagePath,
|
|
path: newPagePath,
|
|
|
body: undefined,
|
|
body: undefined,
|
|
|
- grant: page.grant,
|
|
|
|
|
- // grantUserGroupId: page.grantedGroup,
|
|
|
|
|
- grantUserGroupIds: page.grantedGroups,
|
|
|
|
|
|
|
+ // keep grant info undefined to inherit from parent
|
|
|
|
|
+ grant: undefined,
|
|
|
|
|
+ grantUserGroupIds: undefined,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
mutateChildren();
|
|
mutateChildren();
|
|
@@ -80,7 +80,7 @@ export const useNewPageInput = (): UseNewPageInput => {
|
|
|
if (!hasDescendants) {
|
|
if (!hasDescendants) {
|
|
|
stateHandlers?.setIsOpen(true);
|
|
stateHandlers?.setIsOpen(true);
|
|
|
}
|
|
}
|
|
|
- }, [hasDescendants, mutateChildren, page.grant, page.grantedGroups, stateHandlers]);
|
|
|
|
|
|
|
+ }, [hasDescendants, mutateChildren, stateHandlers]);
|
|
|
|
|
|
|
|
const submittionFailedHandler = useCallback(() => {
|
|
const submittionFailedHandler = useCallback(() => {
|
|
|
setProcessingSubmission(false);
|
|
setProcessingSubmission(false);
|