mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
[Bugfix/v2-beta] Multipages: Page name should have at-least 1 character (#4983)
* fixes: Page handler is also accepting only <space> : but the url should not include blank space * page name and page handler cannot be named with white spaces
This commit is contained in:
parent
f32ce7d14a
commit
0221899bf8
2 changed files with 18 additions and 1 deletions
|
|
@ -1390,6 +1390,11 @@ class EditorComponent extends React.Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if (newHandle.trim().length === 0) {
|
||||
toast.error('Page handle cannot be empty');
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
isSaving: true,
|
||||
|
|
@ -1452,6 +1457,11 @@ class EditorComponent extends React.Component {
|
|||
};
|
||||
|
||||
renamePage = (pageId, newName) => {
|
||||
if (newName.trim().length === 0) {
|
||||
toast.error('Page name cannot be empty');
|
||||
return;
|
||||
}
|
||||
|
||||
const newAppDefinition = {
|
||||
...this.state.appDefinition,
|
||||
pages: {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { EditModal } from './EditModal';
|
|||
import { SettingsModal } from './SettingsModal';
|
||||
import _ from 'lodash';
|
||||
import SortableList from '@/_components/SortableList';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
export const PageHandler = ({
|
||||
darkMode,
|
||||
|
|
@ -194,7 +195,13 @@ export const PageHandler = ({
|
|||
|
||||
export const AddingPageHandler = ({ addNewPage, setNewPageBeingCreated }) => {
|
||||
const handleAddingNewPage = (pageName) => {
|
||||
if (pageName) {
|
||||
if (pageName.trim().length === 0) {
|
||||
toast('Page name should have atleast 1 character', {
|
||||
icon: '⚠️',
|
||||
});
|
||||
}
|
||||
|
||||
if (pageName && pageName.trim().length > 0) {
|
||||
addNewPage({ name: pageName, handle: _.kebabCase(pageName.toLowerCase()) });
|
||||
}
|
||||
setNewPageBeingCreated(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue