Skip to content

Commit

Permalink
Add recipeInfo support for BetaXivapiSource
Browse files Browse the repository at this point in the history
  • Loading branch information
Tnze committed Oct 7, 2024
1 parent 7df0a84 commit e2cecae
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/components/recipe-manager/beta-xivapi-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,24 @@ export class BetaXivApiRecipeSource {
}
}

async recipeInfo(recipeId: number): Promise<RecipeInfo> {
const query = new URLSearchParams({
'fields': 'Icon,ItemResult.Name,CraftType.Name,DifficultyFactor,DurabilityFactor,QualityFactor,MaterialQualityFactor,RecipeLevelTable@as(raw),RequiredCraftsmanship,RequiredControl,CanHq'
});
if (this.language != undefined) query.set('language', this.language)
const url = new URL(`sheet/Recipe/${recipeId}`, this.base).toString() + '?' + query.toString();
const resp = await fetch(url, {
method: 'GET',
mode: 'cors'
})
const data = await resp.json();
if (!resp.ok) {
this.checkRespError(data)
}
console.log(data);
return BetaXivApiRecipeSource.recipeRowsToRecipe(data);
}

async itemInfo(id: number): Promise<Item> {
const query = new URLSearchParams({
'fields': 'Name,LevelItem,CanBeHq,CategoryID'
Expand Down

0 comments on commit e2cecae

Please sign in to comment.