Skip to content

Commit

Permalink
always new filename
Browse files Browse the repository at this point in the history
  • Loading branch information
imran1khan committed Jun 29, 2024
1 parent b449eb5 commit eea59b4
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const defaultValues: Partial<ProjectFormValues> = {

export default function PageClient () {
const user = useUser({ or: 'redirect', projectIdMustMatch: "internal" });
const projectList = user.useOwnedProjects();
const [loading, setLoading] = useState(false);
const form = useForm<ProjectFormValues>({
resolver: yupResolver<ProjectFormValues>(projectFormSchema),
Expand All @@ -49,7 +50,13 @@ export default function PageClient () {
const onSubmit = async (values: ProjectFormValues, e?: React.BaseSyntheticEvent) => {
e?.preventDefault();
setLoading(true);
let newProject;
let newProject;
if (projectList) {
const project_name = projectList.find((v) => v.displayName === values.displayName);
if (project_name) {
values.displayName = values.displayName+`_1`;
}
}
try {
newProject = await user.createProject({
displayName: values.displayName,
Expand Down

0 comments on commit eea59b4

Please sign in to comment.