2017-02-26 1 views

Antwort

0

Sie müssen es in einem benutzerdefinierten restClient tun (siehe https://marmelab.com/admin-on-rest/RestClients.html). Zum Beispiel, wenn die API gibt Datensätze mit einer _id Kennung:

const convertHTTPResponseToREST = (response, type, resource, params) => { 
    const { headers, json } = response; 
    switch (type) { 
    case GET_LIST: 
     return { 
      data: json.map(x => { ...x, id: x._id }), 
      total: parseInt(headers.get('content-range').split('/').pop(), 10), 
     }; 
    case UPDATE: 
    case DELETE: 
    case GET_ONE: 
     return { ...json, id: json._id }; 
    case CREATE: 
     return { ...params.data, id: json._id }; 
    default: 
     return json; 
    } 
}; 

By the way, bitte hier und in the admin-on-rest issue tracker nicht Doppel-Post tun, das gibt mehr Arbeit für die Maintainer.

Verwandte Themen