lundi 11 décembre 2017

Encountered "categories" in payload, but no model was found for model name "category"

Hi when i try to load category product from REST API I get this warning "Encountered "categories" in payload, but no model was found for model name "category" (resolved model name using (unknown mixin).modelNameFromPayloadKey("categories"))" and data is not print.

Data I get from the 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
    }
}

My categories.js serializer

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);
    }
});

When I View categories page i get bellow warning and did not print any data

WARNING: Encountered "categories" in payload, but no model was found for model name "category" (resolved model name using (unknown mixin).modelNameFromPayloadKey("categories"))




Aucun commentaire:

Enregistrer un commentaire