こんにちは、REST APIからカテゴリ製品を読み込もうとしましたが、この警告 "payload"モデル名 "カテゴリ"(未知のmixin).modelNameFromPayloadKey( "categories")を使用して解決されたモデル名) "で、データは印刷されません。ペイロードの "categories"が見つかりましたが、モデル名 "category"のモデルが見つかりませんでした
データは、私はAPIから取得: -
{
"categories": [{
"id": 6737,
"category_id": 1,
"product_id": 3954,
"product": {
"id": 3954,
"seller_id": null,
"sku": "UN1185",
"product": "Party",
"description2": "Disclaimer: ",
"mrp": 795,
"price": 1499,
"off": "75",
"stock": 1,
"total_products": 5,
"catalogType": null,
"weight": "1",
"delivered_in": null,
"chart_id": null,
"stitching": 0,
"seo_title": "Buy Now Party wear Light Peach Khadi Art Silk Plain Saree",
"seo_description": "Shop",
"keyword": "saree",
"position": 1503,
"status": 1,
"product_images": [{
"product_id": 3954,
"url": "UN1185.jpg"
}]
}
}, {
"id": 6735,
"category_id": 1,
"product_id": 3953,
"product": {
"id": 3953,
"seller_id": null,
"sku": "UN1933",
"product": "Party wear Pink Khadi Art Silk Plain Saree",
"slug": "party-wear-pink-khadi-art-silk-plain-saree-un1933",
"description": "Party wear Pink Khad..",
"description2": "Disclaimer",
"mrp": 795,
"price": 1499,
"off": "75",
"stock": 1,
"total_products": 4,
"catalogType": null,
"weight": "1",
"delivered_in": null,
"chart_id": null,
"stitching": 0,
"seo_title": "Buy Now Party",
"seo_keyword": "saree",
"keyword": "saree ",
"position": 1503,
"status": 1,
"product_images": [{
"product_id": 3953,
"url": "UN1933.jpg"
}]
}
}],
"paging": {
"prevPage": false,
"nextPage": true,
"currentPage": 1,
"resultCount": 22
}
}
マイcategories.jsシリアライザ
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
//console.log(payload.categories);
payload = {
categories: payload.categories
};
//console.log(payload);
return this._super(store, primaryModelClass, payload, id, requestType);
}
});
私は怒鳴る警告を取得し、任意のデータを印刷していないページのカテゴリーを見る
WARNING: Encountered "categories" in payload, but no model was found for model name "category" (resolved model name using (unknown mixin).modelNameFromPayloadKey("categories"))