本文整理匯總了TypeScript中utils/featureToggles.FeatureToggles.hasAnyAuthorisedFeature方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FeatureToggles.hasAnyAuthorisedFeature方法的具體用法?TypeScript FeatureToggles.hasAnyAuthorisedFeature怎麽用?TypeScript FeatureToggles.hasAnyAuthorisedFeature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils/featureToggles.FeatureToggles
的用法示例。
在下文中一共展示了FeatureToggles.hasAnyAuthorisedFeature方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: renderView
ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
const { externalId } = req.params
const form: Form<Response> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const claim: Claim = res.locals.claim
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const user: User = res.locals.user
draft.document.response = form.model
if (draft.document.response.type === ResponseType.FULL_ADMISSION) {
if (!draft.document.fullAdmission) {
draft.document.fullAdmission = new FullAdmission()
}
delete draft.document.partialAdmission
delete draft.document.freeMediation
} else if (draft.document.response.type === ResponseType.PART_ADMISSION) {
if (!draft.document.partialAdmission) {
draft.document.partialAdmission = new PartialAdmission()
}
delete draft.document.fullAdmission
delete draft.document.rejectAllOfClaim
delete draft.document.freeMediation
} else {
delete draft.document.fullAdmission
delete draft.document.partialAdmission
delete draft.document.statementOfMeans
}
await new DraftService().save(draft, user.bearerToken)
switch (draft.document.response.type) {
case ResponseType.DEFENCE:
res.redirect(Paths.defenceRejectAllOfClaimPage.evaluateUri({ externalId: externalId }))
break
case ResponseType.PART_ADMISSION:
if (FeatureToggles.hasAnyAuthorisedFeature(claim.features, 'admissions')) {
res.redirect(PartAdmissionPaths.alreadyPaidPage.evaluateUri({ externalId: externalId }))
} else {
res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
}
break
case ResponseType.FULL_ADMISSION:
if (FeatureToggles.hasAnyAuthorisedFeature(claim.features, 'admissions')) {
res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
} else {
res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
}
break
default:
next(new Error(`Unknown response type: ${draft.document.response.type}`))
}
}
}))
示例2: isFeatureEnabledOnClaim
static isFeatureEnabledOnClaim (claim: Claim, feature: string = 'admissions'): boolean {
return FeatureToggles.hasAnyAuthorisedFeature(claim.features, feature)
}
示例3:
(res: express.Response) => FeatureToggles.hasAnyAuthorisedFeature(res.locals.claim.features, feature),