|
|
|
@ -173,19 +173,42 @@ export const toBuyApi = { |
|
|
|
|
|
|
|
|
|
export const stuffApi = { |
|
|
|
|
getStuffs: async (category: string): Promise<{ stuff_array: Stuff[] }> => { |
|
|
|
|
const data = [ |
|
|
|
|
{ "stuff_id": 1, "stuff_name": "牛乳", "category": "乳製品" }, |
|
|
|
|
{ "stuff_id": 2, "stuff_name": "ヨーグルト", "category": "乳製品" }, |
|
|
|
|
{ "stuff_id": 3, "stuff_name": "チーズ", "category": "乳製品" }, |
|
|
|
|
{ "stuff_id": 4, "stuff_name": "バター", "category": "乳製品" }, |
|
|
|
|
{ "stuff_id": 5, "stuff_name": "生クリーム", "category": "乳製品" }, |
|
|
|
|
|
|
|
|
|
{ "stuff_id": 6, "stuff_name": "鮭", "category": "魚・肉" }, |
|
|
|
|
{ "stuff_id": 7, "stuff_name": "鶏むね肉", "category": "魚・肉" }, |
|
|
|
|
{ "stuff_id": 8, "stuff_name": "豚バラ肉", "category": "魚・肉" }, |
|
|
|
|
{ "stuff_id": 9, "stuff_name": "牛ひき肉", "category": "魚・肉" }, |
|
|
|
|
{ "stuff_id": 10, "stuff_name": "まぐろ", "category": "魚・肉" }, |
|
|
|
|
|
|
|
|
|
{ "stuff_id": 11, "stuff_name": "にんじん", "category": "野菜" }, |
|
|
|
|
{ "stuff_id": 12, "stuff_name": "キャベツ", "category": "野菜" }, |
|
|
|
|
{ "stuff_id": 13, "stuff_name": "ほうれん草", "category": "野菜" }, |
|
|
|
|
{ "stuff_id": 14, "stuff_name": "玉ねぎ", "category": "野菜" }, |
|
|
|
|
{ "stuff_id": 15, "stuff_name": "ピーマン", "category": "野菜" }, |
|
|
|
|
|
|
|
|
|
{ "stuff_id": 16, "stuff_name": "醤油", "category": "調味料" }, |
|
|
|
|
{ "stuff_id": 17, "stuff_name": "味噌", "category": "調味料" }, |
|
|
|
|
{ "stuff_id": 18, "stuff_name": "塩", "category": "調味料" }, |
|
|
|
|
{ "stuff_id": 19, "stuff_name": "砂糖", "category": "調味料" }, |
|
|
|
|
{ "stuff_id": 20, "stuff_name": "酢", "category": "調味料" }, |
|
|
|
|
|
|
|
|
|
{ "stuff_id": 21, "stuff_name": "米", "category": "その他" }, |
|
|
|
|
{ "stuff_id": 22, "stuff_name": "パスタ", "category": "その他" }, |
|
|
|
|
{ "stuff_id": 23, "stuff_name": "小麦粉", "category": "その他" }, |
|
|
|
|
{ "stuff_id": 24, "stuff_name": "卵", "category": "その他" }, |
|
|
|
|
{ "stuff_id": 25, "stuff_name": "豆腐", "category": "その他" } |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
const filtered = data.filter(stuff => stuff.category == category) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
"stuff_array": [ |
|
|
|
|
{ |
|
|
|
|
"stuff_id": 6, |
|
|
|
|
"stuff_name": "鯖", |
|
|
|
|
"category": "魚" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"stuff_id": 10, |
|
|
|
|
"stuff_name": "鯛", |
|
|
|
|
"category": "魚", |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
"stuff_array": filtered |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|