@@ -6,7 +6,10 @@ import Snackbar from '@mui/material/Snackbar';
6
6
import Alert from '@mui/material/Alert' ;
7
7
import Modal from '@mui/material/Modal' ;
8
8
import Box from '@mui/material/Box' ;
9
- import { filesToBase64 } from '../../utils/shareUtils' ;
9
+ import { buildURL , extractQueryParams , filesToBase64 , getPath } from '../../utils/shareUtils' ;
10
+ import { useSelector } from 'react-redux' ;
11
+ import { getPages } from '../../dashboard/DashboardSelectors' ;
12
+ import { getGlobalParameters , getPageNumber } from '../../settings/SettingsSelectors' ;
10
13
11
14
interface FeedbackErrors {
12
15
name ?: string ;
@@ -47,6 +50,9 @@ const Feedback = () => {
47
50
maxHeight : '90vh' ,
48
51
overflowY : 'auto' ,
49
52
} ;
53
+ const pages = useSelector ( ( state ) => getPages ( state ) ) ;
54
+ const parameters = useSelector ( ( state ) => getGlobalParameters ( state ) ) ;
55
+ const pageNumber = useSelector ( ( state ) => getPageNumber ( state ) ) ;
50
56
51
57
useEffect ( ( ) => {
52
58
const fetchUserInfo = async ( ) => {
@@ -122,13 +128,16 @@ const Feedback = () => {
122
128
name : reporterName ,
123
129
} ;
124
130
const base64EncodedFiles = attachments ? await filesToBase64 ( attachments ) : null ;
131
+ const url : URL = buildURL (
132
+ getPath ( window . location . href ) ,
133
+ extractQueryParams ( pages , pageNumber , parameters , true )
134
+ ) ;
125
135
const requestBody = {
126
136
contact : reporterContact ,
127
137
description : description ,
128
138
attachments : base64EncodedFiles ,
129
- source : window . location . href
139
+ source : url . toString ( ) ,
130
140
} ;
131
- console . log ( "URL is " , `${ dbQueryUrl } /v1/send-feedback` ) ;
132
141
await axios
133
142
. post ( `${ dbQueryUrl } /v1/send-feedback` , requestBody , {
134
143
headers : {
@@ -225,7 +234,7 @@ const Feedback = () => {
225
234
required
226
235
/>
227
236
{ errors . email && < div style = { { color : 'red' , fontStyle : 'italic' } } > { errors . email } </ div > }
228
- { emailStatus && < small style = { { color : 'lightgray' , fontStyle : 'italic' } } > { emailStatus } </ small > }
237
+ { emailStatus && < small style = { { color : 'lightgray' , fontStyle : 'italic' } } > { emailStatus } </ small > }
229
238
</ label >
230
239
231
240
< label style = { { marginTop : '1em' } } >
@@ -259,11 +268,10 @@ const Feedback = () => {
259
268
style = { {
260
269
marginTop : '2em' ,
261
270
display : 'flex' ,
262
- justifyContent : 'flex-end ' ,
271
+ justifyContent : 'center ' ,
263
272
gap : '1em' ,
264
273
} }
265
274
>
266
- < Button onClick = { closeModal } > Cancel</ Button >
267
275
< Button style = { { padding : '10px 24px' } } type = 'submit' >
268
276
Submit
269
277
</ Button >
0 commit comments