Skip to content

Commit f7b77dc

Browse files
committed
chore: add constants for license header and key
1 parent 117c9a6 commit f7b77dc

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/Common/API/CoreAPI.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { INVALID_LICENSE_KEY, ResponseHeaders } from '@Shared/index'
12
import { API_STATUS_CODES, APIOptions, FALLBACK_REQUEST_TIMEOUT, Host, noop, ResponseType, ServerErrors } from '..'
23
import { CoreAPIConstructorParamsType, FetchAPIParamsType, FetchInTimeParamsType } from './types'
34
import { handleServerError } from './utils'
@@ -46,7 +47,7 @@ class CoreAPI {
4647
).then(
4748
// eslint-disable-next-line consistent-return
4849
async (response) => {
49-
const isLicenseInvalid = response.headers.get('X-License-Status') === 'inValid'
50+
const isLicenseInvalid = response.headers.get(ResponseHeaders.LICENSE_STATUS) === INVALID_LICENSE_KEY
5051

5152
if (isLicenseInvalid && !preventLicenseRedirect) {
5253
this.handleRedirectToLicenseActivation()

src/Shared/constants.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,5 @@ export const Routes = {
537537
export const ENTERPRISE_SUPPORT_LINK = 'enterprise@devtron.ai'
538538

539539
export const CENTRAL_API_LOCAL_STORAGE_KEY = 'centralAPIConfig'
540+
541+
export const INVALID_LICENSE_KEY = 'inValid'

src/Shared/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,3 +1102,7 @@ export interface CentralAPILocalConfig {
11021102
isConnected: boolean | null // true/false acc to connection, null for first time
11031103
updateCount: number // number of times it has been updated, max 3
11041104
}
1105+
1106+
export enum ResponseHeaders {
1107+
LICENSE_STATUS = 'X-License-Status',
1108+
}

0 commit comments

Comments
 (0)