From 39f00c3335e8f03ca565155cdc1a74e06daf793b Mon Sep 17 00:00:00 2001 From: Aayush Yadav <140250471+Aayushkrishnaut@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:20:23 +0530 Subject: [PATCH] Update client.html (#6617) url synchronization with localStorage: Added url.value = localStorage.getItem('url') || '/api'; to sync the url field with localStorage. Error Handling in Axios .catch(): Updated .catch() block to handle Axios errors correctly with err.response and err.message. JSON Parsing in params, data, headers: Wrapped JSON.parse() with try-catch blocks to handle invalid JSON input errors. Default URL Validation: Added a check to ensure a valid URL is provided. Removed IE8 Compatibility Code: Removed the outdated code for Array.prototype.indexOf support. Form Submission Prevention: Added event.preventDefault() to prevent form reload on submission. Co-authored-by: Jay --- sandbox/client.html | 243 +++++++++++++++++++++++--------------------- 1 file changed, 128 insertions(+), 115 deletions(-) diff --git a/sandbox/client.html b/sandbox/client.html index 7b43ab2..a1d3edc 100644 --- a/sandbox/client.html +++ b/sandbox/client.html @@ -2,7 +2,7 @@ AXIOS | Sandbox - +
axios -

 | Sandbox

-
-
+
+

Input

@@ -72,136 +70,151 @@
-

Request

-
No Data
-
+

Request

+
No Data
+
-
-

Response

-
No Data
-
+
+

Response

+
No Data
+
-
-

Error

-
None
+
+

Error

+
None
+
-
- - + + }; + + params.onchange = function () { + localStorage.setItem('params', params.value); + }; + + data.onchange = function () { + localStorage.setItem('data', data.value); + }; + + headers.onchange = function () { + localStorage.setItem('headers', headers.value); + }; + + syncWithLocalStorage(); + syncParamsAndData(); + })(); + - \ No newline at end of file +