无法将 Admin on rest 与我的 rest 集成 api
Not able to integrate Admin on rest with my rest api
我在 returns 客户的快递中创建了休息 api。我正在尝试使用 Admin on rest 在管理面板上显示它们。
我无法显示所有客户,但只显示了最后一位客户。我不确定是什么问题。
下面是我的应用程序代码。
import React, { Component } from 'react';
import { jsonServerRestClient, Admin, Resource } from 'admin-on-rest';
import {UserList} from './users';
class App extends Component {
render() {
console.log({UserList});
return (
<Admin restClient={jsonServerRestClient('http://localhost:8080/api')}>
<Resource name="customer" list={UserList} />
</Admin>
);
}
}
export default App;[enter image description here][1]
下面是users.js
import React from 'react';
import { List, Datagrid, EmailField, TextField } from 'admin-on-rest';
export const UserList = (props) => (
<List title="All users" {...props}>
<Datagrid>
<TextField source="name" />
<EmailField source="emailId" />
</Datagrid>
</List>
);
但是每当我整合列表时,只显示最后一位客户 的详细信息。控制台中还有一条警告说
警告:数组或迭代器中的每个子项都应该有一个唯一的 "key" 属性。
Check the render method of `DatagridBody`.
in TableRow (created by DatagridBody)
in DatagridBody (created by shouldUpdate(DatagridBody))
in shouldUpdate(DatagridBody) (created by Datagrid)
in table (created by Table)
in div (created by Table)
in div (created by Table)
in Table (created by Datagrid)
in Datagrid (created by MuiComponent)
in MuiComponent (at users.js:6)
in div (created by List)
in div (created by Card)
in div (created by Paper)
in Paper (created by Card)
in Card (created by List)
in div (created by List)
in List (created by WithPermissionsFilteredChildren)
in WithPermissionsFilteredChildren (created by getContext(WithPermissionsFilteredChildren))
in getContext(WithPermissionsFilteredChildren) (created by TranslatedComponent(getContext(WithPermissionsFilteredChildren)))
in TranslatedComponent(getContext(WithPermissionsFilteredChildren)) (created by Connect(TranslatedComponent(getContext(WithPermissionsFilteredChildren))))
in Connect(TranslatedComponent(getContext(WithPermissionsFilteredChildren))) (at users.js:5)
请帮助我..我尝试了所有我能做的选择..但幸运的是。
我附上了应用程序的屏幕截图
这可能是因为您使用 _id
而 admin-on-rest
期望 id
。
我在 returns 客户的快递中创建了休息 api。我正在尝试使用 Admin on rest 在管理面板上显示它们。
我无法显示所有客户,但只显示了最后一位客户。我不确定是什么问题。
下面是我的应用程序代码。
import React, { Component } from 'react';
import { jsonServerRestClient, Admin, Resource } from 'admin-on-rest';
import {UserList} from './users';
class App extends Component {
render() {
console.log({UserList});
return (
<Admin restClient={jsonServerRestClient('http://localhost:8080/api')}>
<Resource name="customer" list={UserList} />
</Admin>
);
}
}
export default App;[enter image description here][1]
下面是users.js
import React from 'react';
import { List, Datagrid, EmailField, TextField } from 'admin-on-rest';
export const UserList = (props) => (
<List title="All users" {...props}>
<Datagrid>
<TextField source="name" />
<EmailField source="emailId" />
</Datagrid>
</List>
);
但是每当我整合列表时,只显示最后一位客户 的详细信息。控制台中还有一条警告说
警告:数组或迭代器中的每个子项都应该有一个唯一的 "key" 属性。
Check the render method of `DatagridBody`.
in TableRow (created by DatagridBody)
in DatagridBody (created by shouldUpdate(DatagridBody))
in shouldUpdate(DatagridBody) (created by Datagrid)
in table (created by Table)
in div (created by Table)
in div (created by Table)
in Table (created by Datagrid)
in Datagrid (created by MuiComponent)
in MuiComponent (at users.js:6)
in div (created by List)
in div (created by Card)
in div (created by Paper)
in Paper (created by Card)
in Card (created by List)
in div (created by List)
in List (created by WithPermissionsFilteredChildren)
in WithPermissionsFilteredChildren (created by getContext(WithPermissionsFilteredChildren))
in getContext(WithPermissionsFilteredChildren) (created by TranslatedComponent(getContext(WithPermissionsFilteredChildren)))
in TranslatedComponent(getContext(WithPermissionsFilteredChildren)) (created by Connect(TranslatedComponent(getContext(WithPermissionsFilteredChildren))))
in Connect(TranslatedComponent(getContext(WithPermissionsFilteredChildren))) (at users.js:5)
请帮助我..我尝试了所有我能做的选择..但幸运的是。
我附上了应用程序的屏幕截图
这可能是因为您使用 _id
而 admin-on-rest
期望 id
。