Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,5 @@ const saveMonitoringAreas = (
export * from './delete'
export * from './plan'
export * from './user'
export * from './notification'
export * from './upload'
6 changes: 6 additions & 0 deletions src/api/notification.js
Original file line number Diff line number Diff line change
@@ -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())
}
17 changes: 16 additions & 1 deletion src/components/selectRangeUsePlanPage/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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,
Expand Down Expand Up @@ -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 (
<section className="agreement">
<Banner
header={SELECT_RUP_BANNER_HEADER}
content={SELECT_RUP_BANNER_CONTENT}
/>
<div>{JSON.stringify(displayNotifications)}</div>
<div className="agrm__table-container">
<div className={classes.searchFilterContainer}>
<SearchBar
Expand Down
2 changes: 2 additions & 0 deletions src/constants/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export const API_BASE_URL = isBundled
? `${window.location.origin}/api`
: DEV_ENV.API_BASE_URL

export const GET_NOTIFICATIONS = userid => 'v1/notification'

export const SEARCH_AGREEMENTS = '/v1/agreement/search'
export const GET_AGREEMENT = agreementId => `/v1/agreement/${agreementId}`
export const UPDATE_AGREEMENT_ZONE = agreementId =>
Expand Down