本文整理汇总了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),