|
@@ -1,5 +1,6 @@
|
|
|
import React, { useCallback, useState } from 'react';
|
|
import React, { useCallback, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
+import { isCreatablePage } from '@growi/core/dist/utils/page-path-utils';
|
|
|
import { useRouter } from 'next/router';
|
|
import { useRouter } from 'next/router';
|
|
|
|
|
|
|
|
import { apiv3Post } from '~/client/util/apiv3-client';
|
|
import { apiv3Post } from '~/client/util/apiv3-client';
|
|
@@ -28,7 +29,9 @@ export const PageCreateButton = React.memo((): JSX.Element => {
|
|
|
if (isLoading) return;
|
|
if (isLoading) return;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const parentPath = currentPage?.path || '/';
|
|
|
|
|
|
|
+ const parentPath = currentPage == null || isCreatablePage(currentPage.path)
|
|
|
|
|
+ ? '/'
|
|
|
|
|
+ : currentPage.path;
|
|
|
|
|
|
|
|
const response = await apiv3Post('/pages/', {
|
|
const response = await apiv3Post('/pages/', {
|
|
|
path: parentPath,
|
|
path: parentPath,
|