diff --git a/packages/strapi-admin/admin/src/containers/Webhooks/EditView.js b/packages/strapi-admin/admin/src/containers/Webhooks/EditView.js index 9d74561dd5..0ff5f377e0 100644 --- a/packages/strapi-admin/admin/src/containers/Webhooks/EditView.js +++ b/packages/strapi-admin/admin/src/containers/Webhooks/EditView.js @@ -7,7 +7,6 @@ import React from 'react'; function EditView() { - console.log('hellooo'); return (
Edit
diff --git a/packages/strapi-admin/admin/src/containers/Webhooks/ListView.js b/packages/strapi-admin/admin/src/containers/Webhooks/ListView.js index f1c18ef020..f84479447a 100644 --- a/packages/strapi-admin/admin/src/containers/Webhooks/ListView.js +++ b/packages/strapi-admin/admin/src/containers/Webhooks/ListView.js @@ -4,7 +4,8 @@ * */ -import React from 'react'; +import React, { memo } from 'react'; + import { Header } from '@buffetjs/custom'; import { useGlobalContext } from 'strapi-helper-plugin'; import { List } from '@buffetjs/custom'; @@ -12,60 +13,11 @@ import { List } from '@buffetjs/custom'; import ListRow from '../../components/ListRow'; import Wrapper from './Wrapper'; +import useDataManager from '../../hooks/useDataManager'; + function ListView() { const { formatMessage } = useGlobalContext(); - - // Fake data for now - const data = [ - { - id: 0, - name: 'gatsby', - isEnabled: false, - url: 'http://thisisanexample.com/1234867874', - headers: { - Authorisation: 'x-secret', - }, - hooks: ['createEntry', 'editEntry', 'deleteEntry', 'createMedia'], - links: [ - { - icon: 'pencil', - onClick: () => { - console.log('edit'); - }, - }, - { - icon: 'trash', - onClick: () => { - console.log('delete'); - }, - }, - ], - }, - { - id: 1, - name: 'gatsby', - isEnabled: false, - url: 'http://thisisanexample.com/1234867874', - headers: { - Authorisation: 'x-secret', - }, - hooks: ['createEntry', 'editEntry', 'deleteEntry', 'createMedia'], - links: [ - { - icon: 'pencil', - onClick: () => { - console.log('edit'); - }, - }, - { - icon: 'trash', - onClick: () => { - console.log('delete'); - }, - }, - ], - }, - ]; + const { webhooks } = useDataManager(); // Header props const actions = [ @@ -91,8 +43,7 @@ function ListView() { }; // List props - - const rowsCount = data.length; + const rowsCount = webhooks.length; const titleLabel = `${ rowsCount > 1 ? formatMessage({ id: `Settings.webhook.list.label.plur` }) @@ -108,7 +59,7 @@ function ListView() { const listProps = { title, button: buttonProps, - items: data, + items: webhooks, }; return ( @@ -122,4 +73,4 @@ function ListView() { ); } -export default ListView; +export default memo(ListView); diff --git a/packages/strapi-admin/admin/src/containers/Webhooks/Wrapper.js b/packages/strapi-admin/admin/src/containers/Webhooks/Wrapper.js index 319aa50c36..077c221a75 100644 --- a/packages/strapi-admin/admin/src/containers/Webhooks/Wrapper.js +++ b/packages/strapi-admin/admin/src/containers/Webhooks/Wrapper.js @@ -8,12 +8,7 @@ import styled from 'styled-components'; const Wrapper = styled.div` > div:first-of-type { - margin-bottom: 31px; - } - > div:last-of-type { - > div:first-of-type { - padding-bottom: 1.3rem; - } + margin-bottom: 33px; } `; diff --git a/packages/strapi-admin/admin/src/containers/Webhooks/index.js b/packages/strapi-admin/admin/src/containers/Webhooks/index.js index 5c6bddc2cb..8226d79eea 100644 --- a/packages/strapi-admin/admin/src/containers/Webhooks/index.js +++ b/packages/strapi-admin/admin/src/containers/Webhooks/index.js @@ -6,22 +6,25 @@ import React from 'react'; import { Switch, Route, useRouteMatch } from 'react-router-dom'; +import WebhooksDataManagerProvider from '../WebhooksDataManagerProvider'; import ListView from './ListView'; import EditView from './EditView'; function Webhooks() { - let { path } = useRouteMatch(); + const { path } = useRouteMatch(); return ( -