react-native-in-app-debugger 2.0.9 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Api/useApiInterceptor.js +7 -7
- package/Mock/MockDetails.jsx +9 -4
- package/package.json +1 -1
package/Api/useApiInterceptor.js
CHANGED
|
@@ -19,7 +19,7 @@ const parse = (data) => {
|
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
let
|
|
22
|
+
let interceptorIds = [];
|
|
23
23
|
export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
24
24
|
const [apis, setApis] = useState([]);
|
|
25
25
|
const [bookmarks, setBookmarks] = useState({});
|
|
@@ -92,6 +92,8 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
useEffect(() => {
|
|
95
|
+
interceptorIds.forEach((id) => axios.interceptors.request.eject(id));
|
|
96
|
+
interceptorIds = [];
|
|
95
97
|
const mocked = (url, method) => {
|
|
96
98
|
// console.log('xxxxxx url method', url, method);
|
|
97
99
|
// console.log('xxxxxx mocks', mocks);
|
|
@@ -191,7 +193,7 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
191
193
|
};
|
|
192
194
|
|
|
193
195
|
// --- Intercept Axios globally ---
|
|
194
|
-
axios.interceptors.request.use(
|
|
196
|
+
interceptorIds.push(axios.interceptors.request.use(
|
|
195
197
|
(config) => {
|
|
196
198
|
// console.log('[Axios Request]', config);
|
|
197
199
|
|
|
@@ -223,11 +225,9 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
223
225
|
});
|
|
224
226
|
return Promise.reject(error);
|
|
225
227
|
},
|
|
226
|
-
);
|
|
228
|
+
));
|
|
227
229
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
interceptorId = axios.interceptors.response.use(
|
|
230
|
+
interceptorIds.push(axios.interceptors.response.use(
|
|
231
231
|
(response) => {
|
|
232
232
|
// console.log('[Axios Response]', response);
|
|
233
233
|
|
|
@@ -257,7 +257,7 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
257
257
|
});
|
|
258
258
|
return Promise.reject(error);
|
|
259
259
|
},
|
|
260
|
-
);
|
|
260
|
+
));
|
|
261
261
|
}, [mocks]);
|
|
262
262
|
|
|
263
263
|
const deleteApi = (id) => {
|
package/Mock/MockDetails.jsx
CHANGED
|
@@ -168,11 +168,11 @@ export default (p) => {
|
|
|
168
168
|
})}
|
|
169
169
|
</View>
|
|
170
170
|
{tab === "response" && (
|
|
171
|
-
<View style={{ gap: 3 }}>
|
|
171
|
+
<View style={{ gap: 3, padding: 10 }}>
|
|
172
172
|
<View style={{ flexDirection: "row", gap: 5 }}>
|
|
173
173
|
<Text>Status</Text>
|
|
174
174
|
<TextInput
|
|
175
|
-
style={{
|
|
175
|
+
style={{ ...styles.textField, width: 50 }}
|
|
176
176
|
inputMode="numeric"
|
|
177
177
|
onChangeText={(t) => {
|
|
178
178
|
setTmpResStatus(t);
|
|
@@ -192,10 +192,9 @@ export default (p) => {
|
|
|
192
192
|
<Text>Body</Text>
|
|
193
193
|
<TextInput
|
|
194
194
|
style={{
|
|
195
|
-
|
|
195
|
+
...styles.textField,
|
|
196
196
|
height: 250,
|
|
197
197
|
flex: 1,
|
|
198
|
-
padding: 2,
|
|
199
198
|
}}
|
|
200
199
|
multiline
|
|
201
200
|
onChangeText={setTmpResBody}
|
|
@@ -276,4 +275,10 @@ const styles = StyleSheet.create({
|
|
|
276
275
|
alignItems: "center",
|
|
277
276
|
justifyContent: "center",
|
|
278
277
|
},
|
|
278
|
+
textField: {
|
|
279
|
+
backgroundColor: "#ccc",
|
|
280
|
+
width: 50,
|
|
281
|
+
padding: 2,
|
|
282
|
+
borderRadius: 5,
|
|
283
|
+
},
|
|
279
284
|
});
|
package/package.json
CHANGED