mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: index template versions by template and name (#5993)
* fix: index template versions by template and name We were incorrectly returning template versions by name relative to organizations. This could result in an incorrect version being returned if multiple templates had versions with the same name. * Fix auth referencing * Fix route location * Fix authorize route name * Fix previous call * Fix authorize route name
This commit is contained in:
+4
-2
@@ -231,10 +231,11 @@ export const getTemplateVersions = async (
|
||||
|
||||
export const getTemplateVersionByName = async (
|
||||
organizationId: string,
|
||||
templateName: string,
|
||||
versionName: string,
|
||||
): Promise<TypesGen.TemplateVersion> => {
|
||||
const response = await axios.get<TypesGen.TemplateVersion>(
|
||||
`/api/v2/organizations/${organizationId}/templateversions/${versionName}`,
|
||||
`/api/v2/organizations/${organizationId}/templates/${templateName}/versions/${versionName}`,
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
@@ -245,11 +246,12 @@ export type GetPreviousTemplateVersionByNameResponse =
|
||||
|
||||
export const getPreviousTemplateVersionByName = async (
|
||||
organizationId: string,
|
||||
templateName: string,
|
||||
versionName: string,
|
||||
): Promise<GetPreviousTemplateVersionByNameResponse> => {
|
||||
try {
|
||||
const response = await axios.get<TypesGen.TemplateVersion>(
|
||||
`/api/v2/organizations/${organizationId}/templateversions/${versionName}/previous`,
|
||||
`/api/v2/organizations/${organizationId}/templates/${templateName}/versions/${versionName}/previous`,
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user