File tree 3 files changed +50
-5
lines changed
3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,17 @@ class MainWebViewPanel {
70
70
71
71
return ;
72
72
}
73
-
73
+ const requestObject = {
74
+ requestMethod,
75
+ requestUrl,
76
+ authOption,
77
+ authData,
78
+ bodyOption,
79
+ bodyRawOption,
80
+ bodyRawData,
81
+ keyValueTableData,
82
+ command,
83
+ } ;
74
84
this . #url = getUrl ( requestUrl ) ;
75
85
this . #method = requestMethod ;
76
86
this . #headers = getHeaders ( keyValueTableData , authOption , authData ) ;
@@ -81,12 +91,12 @@ class MainWebViewPanel {
81
91
bodyRawData ,
82
92
) ;
83
93
84
- this . #postWebviewMessage( ) ;
94
+ this . #postWebviewMessage( requestObject ) ;
85
95
} ,
86
96
) ;
87
97
}
88
98
89
- async #postWebviewMessage( ) {
99
+ async #postWebviewMessage( requestObject ) {
90
100
const { userRequestHistory } = this . stateManager . getExtensionContext (
91
101
COLLECTION . HISTORY_COLLECTION ,
92
102
) ;
@@ -114,6 +124,7 @@ class MainWebViewPanel {
114
124
favoritedTime : null ,
115
125
isUserFavorite : false ,
116
126
id : uuidv4 ( ) ,
127
+ requestObject,
117
128
} ,
118
129
] ,
119
130
} ,
@@ -129,6 +140,7 @@ class MainWebViewPanel {
129
140
favoritedTime : null ,
130
141
isUserFavorite : false ,
131
142
id : uuidv4 ( ) ,
143
+ requestObject,
132
144
} ,
133
145
...userRequestHistory ,
134
146
] ,
@@ -137,6 +149,9 @@ class MainWebViewPanel {
137
149
}
138
150
}
139
151
152
+ console . log (
153
+ this . stateManager . getExtensionContext ( COLLECTION . HISTORY_COLLECTION ) ,
154
+ ) ;
140
155
this . mainPanel . webview . postMessage ( responseObject ) ;
141
156
this . sidebarWebViewPanel . postMainWebViewPanelMessage (
142
157
this . stateManager . getExtensionContext ( COLLECTION . HISTORY_COLLECTION ) ,
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import styled from "styled-components" ;
3
+ import shallow from "zustand/shallow" ;
3
4
4
5
import { OPTION , REQUEST } from "../../../constants" ;
5
6
import useStore from "../../../store/useStore" ;
6
7
7
8
const RequestMethod = ( ) => {
8
- const handleRequestMethodChange = useStore (
9
- ( state ) => state . handleRequestMethodChange ,
9
+ const { requestMethod, handleRequestMethodChange } = useStore (
10
+ ( state ) => ( {
11
+ requestMethod : state . requestMethod ,
12
+ handleRequestMethodChange : state . handleRequestMethodChange ,
13
+ } ) ,
14
+ shallow ,
10
15
) ;
11
16
12
17
return (
13
18
< MethodSelectOptionWrapper
14
19
name = "httpRequestMethods"
20
+ value = { requestMethod }
15
21
onChange = { ( event ) => handleRequestMethodChange ( event . target . value ) }
16
22
>
17
23
{ OPTION . REQUEST_METHOD_OPTIONS . map ( ( requestMethod , index ) => (
Original file line number Diff line number Diff line change @@ -15,12 +15,16 @@ const ResponsePanel = () => {
15
15
requestInProcess,
16
16
handleResponseData,
17
17
handleRequestProcessStatus,
18
+ handleSidebarCollectionHeaders,
19
+ handleSidebarCollectionClick,
18
20
} = useStore (
19
21
( state ) => ( {
20
22
responseData : state . responseData ,
21
23
requestInProcess : state . requestInProcess ,
22
24
handleResponseData : state . handleResponseData ,
23
25
handleRequestProcessStatus : state . handleRequestProcessStatus ,
26
+ handleSidebarCollectionClick : state . handleSidebarCollectionClick ,
27
+ handleSidebarCollectionHeaders : state . handleSidebarCollectionHeaders ,
24
28
} ) ,
25
29
shallow ,
26
30
) ;
@@ -34,6 +38,26 @@ const ResponsePanel = () => {
34
38
handleRequestProcessStatus ( RESPONSE . ERROR ) ;
35
39
} else if ( event . data . type === RESPONSE . COLLECTION_REQUEST ) {
36
40
handleRequestProcessStatus ( COMMON . LOADING ) ;
41
+ } else if ( event . data . type === RESPONSE . SIDE_BAR_DATA ) {
42
+ const {
43
+ keyValueTableData,
44
+ authData,
45
+ authOption,
46
+ requestUrl,
47
+ requestMethod,
48
+ bodyOption,
49
+ bodyRawOption,
50
+ } = event . data ;
51
+
52
+ handleSidebarCollectionClick ( {
53
+ authData,
54
+ authOption,
55
+ requestUrl,
56
+ requestMethod,
57
+ bodyOption,
58
+ bodyRawOption,
59
+ } ) ;
60
+ handleSidebarCollectionHeaders ( keyValueTableData ) ;
37
61
}
38
62
} ;
39
63
You can’t perform that action at this time.
0 commit comments