Skip to content

Commit c817acd

Browse files
committed
fix: use constant for api route
1 parent f8c63b0 commit c817acd

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Common/Constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const URLS = {
8989
GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP_CREATE: `${GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP}/create`,
9090
// NOTE: using appId since we are re-using AppConfig component
9191
GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP_DETAIL: `${GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP}/detail/:appId`,
92-
}
92+
} as const
9393

9494
export const ROUTES = {
9595
APP: 'app',
@@ -148,7 +148,8 @@ export const ROUTES = {
148148
CD_TRIGGER_POST: 'app/cd-pipeline/trigger',
149149
DELETE_RESOURCE: 'k8s/resource/delete',
150150
NODE_CAPACITY: 'k8s/capacity/node',
151-
}
151+
RESOURCE_TEMPLATE: 'resource/template',
152+
} as const
152153

153154
export enum KEY_VALUE {
154155
KEY = 'key',

src/Shared/Services/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const getAppEnvDeploymentConfig = ({
6666
params: AppEnvDeploymentConfigPayloadType
6767
signal?: AbortSignal
6868
isTemplateView: AppConfigProps['isTemplateView']
69-
appId: string | number
69+
appId: string | number | null
7070
}): Promise<ResponseType<AppEnvDeploymentConfigDTO>> => {
7171
const url = isTemplateView
7272
? getTemplateAPIRoute({

src/Shared/Services/template.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { getUrlWithSearchParams } from '@Common/Helper'
22
import { GetTemplateAPIRouteProps } from '@Pages/index'
3+
import { ROUTES } from '@Common/Constants'
34
import { getResourceApiUrl, ResourceKindType, ResourceVersionType } from '..'
45

56
export const getTemplateAPIRoute = ({ type, queryParams: { id, ...restQueryParams } }: GetTemplateAPIRouteProps) =>
67
getUrlWithSearchParams(
78
`${getResourceApiUrl({
8-
baseUrl: 'resource/template',
9+
baseUrl: ROUTES.RESOURCE_TEMPLATE,
910
kind: ResourceKindType.devtronApplication,
1011
version: ResourceVersionType.alpha1,
1112
})}/${type}`,

0 commit comments

Comments
 (0)