diff --git a/src/api/index.js b/src/api/index.js index 322c70ed3..dd6ad188c 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -389,4 +389,5 @@ const saveMonitoringAreas = ( export * from './delete' export * from './plan' export * from './user' +export * from './notification' export * from './upload' diff --git a/src/api/notification.js b/src/api/notification.js new file mode 100644 index 000000000..d06b58ce8 --- /dev/null +++ b/src/api/notification.js @@ -0,0 +1,6 @@ +import * as API from '../constants/api' +import { getAuthHeaderConfig, axios } from '../utils' + +export const getNotifications = async userId => { + return axios.get(API.GET_NOTIFICATIONS(userId), getAuthHeaderConfig()) +} diff --git a/src/components/selectRangeUsePlanPage/index.js b/src/components/selectRangeUsePlanPage/index.js index 7010831fe..56465ace2 100644 --- a/src/components/selectRangeUsePlanPage/index.js +++ b/src/components/selectRangeUsePlanPage/index.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useEffect, useState } from 'react' import useSWR from 'swr' import * as API from '../../constants/api' import { axios, getAuthHeaderConfig, isUserRangeOfficer } from '../../utils' @@ -7,6 +7,7 @@ import { makeStyles } from '@material-ui/core/styles' import ZoneSelect from './ZoneSelect' import SearchBar from './SearchBar' import { Banner } from '../common' +import { getNotifications } from '../../api/index' import { SELECT_RUP_BANNER_HEADER, SELECT_RUP_BANNER_CONTENT, @@ -67,12 +68,26 @@ const SelectRangeUsePlanPage = ({ match, history }) => { const { agreements, totalPages, currentPage = page, totalItems } = data || {} const classes = useStyles() + const [displayNotifications, setDisplayNotifications] = useState([]) + + useEffect(() => { + getNotifications(user).then(result => { + if (result) { + if (result.data.notifications.examples) { + console.log('got there)') + setDisplayNotifications(result.data.notifications.examples) + } + } + }) + }, []) + return (
+
{JSON.stringify(displayNotifications)}
'v1/notification' + export const SEARCH_AGREEMENTS = '/v1/agreement/search' export const GET_AGREEMENT = agreementId => `/v1/agreement/${agreementId}` export const UPDATE_AGREEMENT_ZONE = agreementId =>