- This will break the link between this project and the template it was - created from. -
-{projectName}
successfully unlinked.
+ >
+ );
+}
+
+interface ProjectUnlinkTemplateProps {
+ project: Project;
+}
+export default function ProjectUnlinkTemplate({
+ project,
+}: ProjectUnlinkTemplateProps) {
+ const [patchProject, result] = usePatchProjectsByProjectIdMutation();
+ const navigate = useNavigate();
+ const { notifications } = useContext(AppContext);
+ const onUnlink = useCallback(() => {
+ patchProject({
+ projectId: project.id,
+ "If-Match": project.etag ?? "",
+ projectPatch: {
+ template_id: "",
+ },
+ });
+ }, [patchProject, project.etag, project.id]);
+
+ useEffect(() => {
+ if (result.isSuccess) {
+ if (notifications)
+ notificationProjectDeleted(notifications, project.name);
+ }
+ }, [result.isSuccess, navigate, notifications, project.name]);
+
+ const [typedName, setTypedName] = useState("");
+ const onChange = useCallback(
+ (e: React.ChangeEvent+ This will break the link between this project and the template it was + created from. +
++ Are you sure you want to unlink this project from its template? +
++ This cannot be undone. Please type {project.slug}, + the slug of the project, to confirm. +
+