本文整理汇总了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;未经允许,请勿转载。 |
请发表评论