Skip to content

Commit 21be4c7

Browse files
committed
fix: update template examples for multi-org
1 parent e5aec0b commit 21be4c7

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

site/src/api/api.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,11 +1659,9 @@ class ApiMethods {
16591659
return response.data;
16601660
};
16611661

1662-
getTemplateExamples = async (
1663-
organizationId: string,
1664-
): Promise<TypesGen.TemplateExample[]> => {
1662+
getTemplateExamples = async (): Promise<TypesGen.TemplateExample[]> => {
16651663
const response = await this.axios.get(
1666-
`/api/v2/organizations/${organizationId}/templates/examples`,
1664+
`/api/v2/organizations/00000000-0000-0000-0000-000000000000/templates/examples`,
16671665
);
16681666

16691667
return response.data;

site/src/api/queries/templates.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,10 @@ export const setGroupRole = (
101101
};
102102
};
103103

104-
export const templateExamples = (organizationId: string) => {
104+
export const templateExamples = () => {
105105
return {
106-
queryKey: [
107-
...getTemplatesByOrganizationIdQueryKey(organizationId),
108-
"examples",
109-
],
110-
queryFn: () => API.getTemplateExamples(organizationId),
106+
queryKey: ["templates", "examples"],
107+
queryFn: () => API.getTemplateExamples(),
111108
};
112109
};
113110

site/src/pages/CreateTemplatesGalleryPage/CreateTemplatesGalleryPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { CreateTemplatesPageView } from "./CreateTemplatesPageView";
1010
import { StarterTemplatesPageView } from "./StarterTemplatesPageView";
1111

1212
const CreateTemplatesGalleryPage: FC = () => {
13-
const { organizationId, experiments } = useDashboard();
14-
const templateExamplesQuery = useQuery(templateExamples(organizationId));
13+
const { experiments } = useDashboard();
14+
const templateExamplesQuery = useQuery(templateExamples());
1515
const starterTemplatesByTag = templateExamplesQuery.data
1616
? // Currently, the scratch template should not be displayed on the starter templates page.
1717
getTemplatesByTag(removeScratchExample(templateExamplesQuery.data))

site/src/pages/StarterTemplatePage/StarterTemplatePage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { Helmet } from "react-helmet-async";
33
import { useQuery } from "react-query";
44
import { useParams } from "react-router-dom";
55
import { templateExamples } from "api/queries/templates";
6-
import { useDashboard } from "modules/dashboard/useDashboard";
76
import { pageTitle } from "utils/page";
87
import { StarterTemplatePageView } from "./StarterTemplatePageView";
98

109
const StarterTemplatePage: FC = () => {
1110
const { exampleId } = useParams() as { exampleId: string };
12-
const { organizationId } = useDashboard();
13-
const templateExamplesQuery = useQuery(templateExamples(organizationId));
11+
const templateExamplesQuery = useQuery(templateExamples());
1412
const starterTemplate = templateExamplesQuery.data?.find(
1513
(example) => example.id === exampleId,
1614
);

site/src/pages/TemplatesPage/TemplatesPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const TemplatesPage: FC = () => {
2525
? getTemplatesByOrg(templatesQuery.data)
2626
: undefined;
2727
const examplesQuery = useQuery({
28-
...templateExamples(organizationId),
28+
...templateExamples(),
2929
enabled: permissions.createTemplates,
3030
});
3131
const error =

0 commit comments

Comments
 (0)