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


TypeScript webAPI.TraitsAPI.GetTraitsV1方法代码示例

本文整理汇总了TypeScript中@csegames/camelot-unchained.webAPI.TraitsAPI.GetTraitsV1方法的典型用法代码示例。如果您正苦于以下问题:TypeScript webAPI.TraitsAPI.GetTraitsV1方法的具体用法?TypeScript webAPI.TraitsAPI.GetTraitsV1怎么用?TypeScript webAPI.TraitsAPI.GetTraitsV1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@csegames/camelot-unchained.webAPI.TraitsAPI的用法示例。


在下文中一共展示了webAPI.TraitsAPI.GetTraitsV1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getTraits

async function getTraits(dispatch: (action: any) => any, payload: FetchTraitInterface) {
  const config: RequestConfig = () => ({
    url: payload.apiHost,
    headers: {
      Authorization: `${client.ACCESS_TOKEN_PREFIX} ${patcher.getAccessToken()}`,
    },
  });
  const res = await webAPI.TraitsAPI.GetTraitsV1(config, client.shardID);
  if (res.ok) {
    const data = JSON.parse(res.data);
    dispatch(onInitializeTraits({
      playerClass: _.trim(payload.playerClass),
      race: payload.race,
      faction: payload.faction,
      banesAndBoons: data,
      initType: payload.initType,
    }));
  } else {
    toastr.error(
      'We are having technical difficulties. You will not be able to create a character until they have been fixed.',
      'Oh No!!',
      { timeOut: 5000 },
    );
  }
}
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:25,代码来源:banesAndBoons.ts

示例2: return

 return (dispatch: (action: any) => any) => {
   const config: RequestConfig = () => ({
     url: payload.apiHost,
     headers: {
       Authorization: `${client.ACCESS_TOKEN_PREFIX} ${patcher.getAccessToken()}`,
     },
   });
   return webAPI.TraitsAPI.GetTraitsV1(config, client.shardID)
     .then((result) => {
       const data = JSON.parse(result.data);
       if (result.ok) {
         if (payload.initType === 'boons') {
           dispatch(onResetBoons({
             playerClass: payload.playerClass,
             race: payload.race,
             faction: payload.faction,
             banesAndBoons: data,
           }));
         }
         if (payload.initType === 'banes') {
           dispatch(onResetBanes({
             playerClass: payload.playerClass,
             race: payload.race,
             faction: payload.faction,
             banesAndBoons: data,
           }));
         }
         if (payload.initType === 'both') {
           dispatch(onResetBoons({
             playerClass: payload.playerClass,
             race: payload.race,
             faction: payload.faction,
             banesAndBoons: data,
           }));
           dispatch(onResetBanes({
             playerClass: payload.playerClass,
             race: payload.race,
             faction: payload.faction,
             banesAndBoons: data,
           }));
         }
       }
     });
 };
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:44,代码来源:banesAndBoons.ts


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