|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
* バックエンドAPIとの通信を担当するモジュール |
|
|
|
|
* 認証、タスク管理などの機能を提供 |
|
|
|
|
*/ |
|
|
|
|
import { LoginCredentials, RegisterCredentials, AuthResponse, /* Task, */ ToBuy, Stuff, Stock, RecipeDetail, StuffAndCategoryAndAmount, RecipeWithId, StockHistory, StockUpdateRequest } from '../types/types'; |
|
|
|
|
import { LoginCredentials, RegisterCredentials, AuthResponse, /* Task, */ ToBuy, Stuff, Stock, RecipeDetail, StuffAndCategoryAndAmount, RecipeWithId, StockHistory, StockUpdateRequest, RecipeDetailWithId } from '../types/types'; |
|
|
|
|
import { AUTH_ERRORS, TOBUY_ERRORS, STOCK_ERRORS, RECIPE_ERRORS } from '../constants/errorMessages'; |
|
|
|
|
|
|
|
|
|
// APIのベースURL - 環境変数から取得するか、デフォルト値を使用
|
|
|
|
@ -469,12 +469,7 @@ export const recipeApi = { |
|
|
|
|
* @param recipeId 取得対象のレシピID |
|
|
|
|
* @returns レシピ詳細情報 |
|
|
|
|
*/ |
|
|
|
|
getById: async (recipeId: number): Promise<{ |
|
|
|
|
recipeId: number; |
|
|
|
|
recipeName: string; |
|
|
|
|
summary: string; |
|
|
|
|
stuffAndAmountArray: StuffAndCategoryAndAmount[]; |
|
|
|
|
}> => { |
|
|
|
|
getById: async (recipeId: number): Promise<RecipeDetailWithId> => { |
|
|
|
|
const response = await fetch(`${API_BASE_URL}/api/recipes/getById?recipeId=${recipeId}`, { |
|
|
|
|
method: 'GET', |
|
|
|
|
headers: getHeaders(), |
|
|
|
|