当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript FeatureToggles.hasAnyAuthorisedFeature方法代码示例

本文整理汇总了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}`))
        }
      }
    }))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:60,代码来源:response-type.ts

示例2: isFeatureEnabledOnClaim

 static isFeatureEnabledOnClaim (claim: Claim, feature: string = 'admissions'): boolean {
   return FeatureToggles.hasAnyAuthorisedFeature(claim.features, feature)
 }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:claimFeatureToggles.ts

示例3:

 (res: express.Response) => FeatureToggles.hasAnyAuthorisedFeature(res.locals.claim.features, feature),
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:1,代码来源:optInFeatureToggleGuard.ts


注:本文中的utils/featureToggles.FeatureToggles.hasAnyAuthorisedFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。