2019-10-27 14:03:39 -07:00
|
|
|
import React, { FC } from 'react';
|
|
|
|
import { RouteComponentProps } from '@reach/router';
|
2020-01-14 10:34:48 -08:00
|
|
|
import PathPrefixProps from '../../types/PathPrefixProps';
|
2020-01-27 01:27:43 -08:00
|
|
|
import { useFetch } from '../../hooks/useFetch';
|
|
|
|
import { withStatusIndicator } from '../../components/withStatusIndicator';
|
|
|
|
import { RulesMap, RulesContent } from './RulesContent';
|
|
|
|
|
|
|
|
const RulesWithStatusIndicator = withStatusIndicator(RulesContent);
|
|
|
|
|
|
|
|
const Rules: FC<RouteComponentProps & PathPrefixProps> = ({ pathPrefix }) => {
|
|
|
|
const { response, error, isLoading } = useFetch<RulesMap>(`${pathPrefix}/api/v1/rules`);
|
|
|
|
|
|
|
|
return <RulesWithStatusIndicator response={response} error={error} isLoading={isLoading} />;
|
|
|
|
};
|
2019-10-27 14:03:39 -07:00
|
|
|
|
|
|
|
export default Rules;
|