1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

fix: make the project submission work from the project creation modal (#7040)

It seems the code that was copied was copied from before we changed
the validation logic, so it wouldn't submit. This fixes that to remove
any ID validation in the new form.
This commit is contained in:
Thomas Heartman 2024-05-13 10:49:05 +02:00 committed by GitHub
parent 40e4e355e3
commit fddb78380e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,14 +87,15 @@ export const CreateProjectDialogue = ({
e.preventDefault();
clearErrors();
const validName = validateName();
const validId = await validateProjectId();
if (validName && validId) {
const payload = getCreateProjectPayload();
if (validName) {
const payload = getCreateProjectPayload({
omitId: true,
});
try {
await createProject(payload);
const createdProject = await createProject(payload);
refetchUser();
navigate(`/projects/${projectId}`, { replace: true });
navigate(`/projects/${createdProject.id}`, { replace: true });
setToastData({
title: 'Project created',
text: 'Now you can add toggles to this project',
@ -113,7 +114,6 @@ export const CreateProjectDialogue = ({
}
}
};
return (
<StyledDialog open={open} onClose={onClose}>
<FormTemplate