mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-12 17:35:21 +02:00
refactor: update API and dashboard components to replace projectId with environmentId for improved context handling and authorization checks
This commit is contained in:
@@ -103,8 +103,6 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
|
||||
useState<TemplateInfo>(defaultTemplateInfo);
|
||||
const utils = api.useUtils();
|
||||
|
||||
// Get environment data to extract projectId
|
||||
const { data: environment } = api.environment.one.useQuery({ environmentId });
|
||||
|
||||
const haveAtleasOneProviderEnabled = aiSettings?.some(
|
||||
(ai) => ai.isEnabled === true,
|
||||
@@ -124,7 +122,7 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
|
||||
|
||||
const onSubmit = async () => {
|
||||
await mutateAsync({
|
||||
projectId: environment?.projectId || "",
|
||||
environmentId: environmentId,
|
||||
id: templateInfo.details?.id || "",
|
||||
name: templateInfo?.details?.name || "",
|
||||
description: templateInfo?.details?.shortDescription || "",
|
||||
@@ -142,7 +140,9 @@ export const TemplateGenerator = ({ environmentId }: Props) => {
|
||||
toast.success("Compose Created");
|
||||
setOpen(false);
|
||||
// Invalidate the project query to refresh the environment data
|
||||
await utils.project.one.invalidate();
|
||||
await utils.environment.one.invalidate({
|
||||
environmentId,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error("Error creating the compose");
|
||||
|
||||
Reference in New Issue
Block a user