File tree Expand file tree Collapse file tree 7 files changed +17
-16
lines changed
Shared/Components/DevtronLicenseCard Expand file tree Collapse file tree 7 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,12 @@ class CoreAPI {
49
49
50
50
if ( isLicenseInvalid && ! preventLicenseRedirect ) {
51
51
this . handleRedirectToLicenseActivation ( )
52
+
53
+ return new Promise ( ( resolve ) => {
54
+ setTimeout ( ( ) => {
55
+ resolve ( { code : API_STATUS_CODES . UNAUTHORIZED , status : 'Unauthorized' , result : [ ] } )
56
+ } , 1000 )
57
+ } )
52
58
}
53
59
54
60
const contentType = response . headers . get ( 'Content-Type' )
Original file line number Diff line number Diff line change @@ -21,14 +21,8 @@ export interface FetchInTimeParamsType<Data = object> {
21
21
isMultipartRequest ?: boolean
22
22
}
23
23
24
- export interface FetchAPIParamsType < Data = object > extends Omit < FetchInTimeParamsType < Data > , 'options' > {
24
+ export interface FetchAPIParamsType < Data = object >
25
+ extends Omit < FetchInTimeParamsType < Data > , 'options' > ,
26
+ Pick < APIOptions , 'preventAutoLogout' | 'preventLicenseRedirect' > {
25
27
signal : AbortSignal
26
- /**
27
- * @default false
28
- */
29
- preventAutoLogout ?: boolean
30
- /**
31
- * @default false
32
- */
33
- preventLicenseRedirect ?: boolean
34
28
}
Original file line number Diff line number Diff line change @@ -1077,3 +1077,6 @@ export const getHashedValue = async (value: string): Promise<string | null> => {
1077
1077
return null
1078
1078
}
1079
1079
}
1080
+
1081
+ export const getTTLInHumanReadableFormat = ( ttl : number ) : string =>
1082
+ moment . duration ( Math . abs ( ttl ) , 'seconds' ) . humanize ( false )
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ export interface APIOptions {
65
65
*/
66
66
signal ?: AbortSignal
67
67
abortControllerRef ?: MutableRefObject < AbortController >
68
+ /**
69
+ * @default false
70
+ */
68
71
preventAutoLogout ?: boolean
69
72
/**
70
73
* @default false
Original file line number Diff line number Diff line change 1
- import { ClipboardButton } from '@Common/index'
1
+ import { ClipboardButton , getTTLInHumanReadableFormat } from '@Common/index'
2
2
import { ReactComponent as ICChatSupport } from '@IconsV2/ic-chat-circle-dots.svg'
3
3
import { DevtronLicenseCardProps , ENTERPRISE_SUPPORT_LINK , LicenseStatus } from '@Shared/index'
4
4
import { Button , ButtonVariantType } from '../Button'
5
5
import { Icon } from '../Icon'
6
- import { getLicenseColorsAccordingToStatus , getTTLInHumanReadableFormat } from './utils'
6
+ import { getLicenseColorsAccordingToStatus } from './utils'
7
7
import './licenseCard.scss'
8
8
9
9
export const DevtronLicenseCard = ( {
Original file line number Diff line number Diff line change 1
1
export { default as DevtronLicenseCard } from './DevtronLicenseCard'
2
- export { getTTLInHumanReadableFormat } from './utils'
Original file line number Diff line number Diff line change 1
1
import { LicenseStatus } from '@Shared/index'
2
- import moment from 'moment'
3
2
4
3
export const getLicenseColorsAccordingToStatus = (
5
4
licenseStatus : LicenseStatus ,
@@ -13,6 +12,3 @@ export const getLicenseColorsAccordingToStatus = (
13
12
return { bgColor : 'var(--R100)' , textColor : 'var(--R500)' }
14
13
}
15
14
}
16
-
17
- export const getTTLInHumanReadableFormat = ( ttl : number ) : string =>
18
- moment . duration ( Math . abs ( ttl ) , 'seconds' ) . humanize ( false )
You can’t perform that action at this time.
0 commit comments