mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-21 13:40:31 -06:00
Compare commits
8 Commits
4.0.0
...
fix/valida
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a8e4f562c | ||
|
|
82f7029958 | ||
|
|
a56b42e7ce | ||
|
|
b6223d1b0a | ||
|
|
9a4dd4a60d | ||
|
|
8eabe4aa88 | ||
|
|
43e07b846f | ||
|
|
ac324e5e9a |
@@ -15,6 +15,7 @@ import {
|
||||
import { Input } from "@/modules/ui/components/input";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useTranslate } from "@tolgee/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { SubmitHandler, useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import { z } from "zod";
|
||||
@@ -31,6 +32,7 @@ type TEditProjectName = z.infer<typeof ZProjectNameInput>;
|
||||
|
||||
export const EditProjectNameForm: React.FC<EditProjectNameProps> = ({ project, isReadOnly }) => {
|
||||
const { t } = useTranslate();
|
||||
const router = useRouter();
|
||||
const form = useForm<TEditProjectName>({
|
||||
defaultValues: {
|
||||
name: project.name,
|
||||
@@ -62,6 +64,7 @@ export const EditProjectNameForm: React.FC<EditProjectNameProps> = ({ project, i
|
||||
if (updatedProjectResponse?.data) {
|
||||
toast.success(t("environments.project.general.project_name_updated_successfully"));
|
||||
form.resetField("name", { defaultValue: updatedProjectResponse.data.name });
|
||||
router.refresh();
|
||||
} else {
|
||||
const errorMessage = getFormattedErrorMessage(updatedProjectResponse);
|
||||
toast.error(errorMessage);
|
||||
|
||||
Reference in New Issue
Block a user