當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript camelot-unchained.webAPI.TraitsAPI類代碼示例

本文整理匯總了TypeScript中@csegames/camelot-unchained.webAPI.TraitsAPI的典型用法代碼示例。如果您正苦於以下問題:TypeScript webAPI.TraitsAPI類的具體用法?TypeScript webAPI.TraitsAPI怎麽用?TypeScript webAPI.TraitsAPI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了webAPI.TraitsAPI類的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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。