@@ -68,9 +96,18 @@ const ManageRequestsScreen = () => {
{isManaged ? 'Managed' : 'Not Managed'} |
{moment(createdAt?.toDate()).fromNow()} |
-
-
-
+
+
+
+
+
+
+ deleteHandler(id)}
+ >
+
+
|
)
diff --git a/src/screens/RequestDetailsScreen.js b/src/screens/RequestDetailsScreen.js
index 78bd300..239f9f5 100644
--- a/src/screens/RequestDetailsScreen.js
+++ b/src/screens/RequestDetailsScreen.js
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from 'react'
-import moment from 'moment'
import { doc, onSnapshot } from 'firebase/firestore'
import { db } from '../firebase'
import { useParams } from 'react-router-dom'
@@ -110,8 +109,8 @@ function RequestDetailsScreen() {
Bag managed: {numManaged}
Posted in:{' '}
- {new Date(createdAt?.toDate()).toLocaleString()} (
- {moment(createdAt?.toDate()).fromNow()})
+ {new Date(createdAt?.toDate()).toLocaleString()}
+ {/* ({moment(createdAt?.toDate()).fromNow()}) */}
diff --git a/src/screens/RequestEditScreen.js b/src/screens/RequestEditScreen.js
index aa50e92..2eca3f6 100644
--- a/src/screens/RequestEditScreen.js
+++ b/src/screens/RequestEditScreen.js
@@ -104,7 +104,7 @@ const RequestEditScreen = () => {
{error && {error}}
{loading && }
- {uid === userInfo.uid ? (
+ {uid === userInfo.uid || userInfo.isAdmin ? (
{
) : (
diff --git a/src/screens/RequestScreen.js b/src/screens/RequestScreen.js
index f0fddcf..a0febd5 100644
--- a/src/screens/RequestScreen.js
+++ b/src/screens/RequestScreen.js
@@ -7,6 +7,7 @@ import Loader from './../components/Loader'
import { useSelector } from 'react-redux'
import Required from './../components/Required'
import SubHero from '../components/SubHero/SubHero'
+import { useNavigate } from 'react-router-dom'
const RequestPage = () => {
const [problem, setProblem] = useState('')
@@ -24,6 +25,8 @@ const RequestPage = () => {
const userDetails = useSelector((state) => state.userDetails)
const { userInfo } = userDetails
+ const navigate = useNavigate()
+
const submitHandler = async (e) => {
e.preventDefault()
@@ -57,6 +60,8 @@ const RequestPage = () => {
setDate('')
setLoading(false)
setSuccess(true)
+
+ navigate('/feed')
} catch (error) {
setLoading(false)
setError(error.message)
@@ -83,6 +88,7 @@ const RequestPage = () => {
{
setBloodGroup(e.target.value)}
required={true}
@@ -122,6 +129,7 @@ const RequestPage = () => {
{
{
{
{
{