감사에서 그것을 반환 할 수 있습니다. 답변에 코드 기반을 씁니다.
사용자 지정 restClient 응답 데이터의 경로를 지정합니다.
const convertHTTPResponseToREST = (response, type, resource, params) => {
const { headers, json } = response;
switch (type) {
case GET_LIST:
case GET_MANY_REFERENCE:
if (!headers.has('content-range')) {
throw new Error(
'The Content-Range header is missing in the HTTP Response. The simple REST client expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?'
);
}
// IF you just want use with **users** resource.
if(resource === 'users') {
return {
data: json.result,
total: parseInt(
headers
.get('content-range')
.split('/')
.pop(),
10
),
};
}
return {
data: json.result,
total: parseInt(
headers
.get('content-range')
.split('/')
.pop(),
10
),
};
case CREATE:
return { data: { ...params.data, id: json.id } };
default:
return { data: json };
}
};
키워드 : 자식 요소의 목록, 목록 둥지
덕분에, 내가 – Alexey
예, 작동 할 것입니다. 나는 당신에게 @pelak 감사합니다. 너는 내 하루를 구한다. 이 기능에 대한 관리자 대 휴식의 개선에 대한 제안에 대해 어떻게 생각하나요, 아니면 그렇게 쉽고 가치가 없습니다. – Alexey
내 하루를 저장합니다. –