Spaces:
Sleeping
Sleeping
Esteves Enzo
commited on
Commit
·
8b61aa5
1
Parent(s):
8f469b4
add public banner + fix format boddy
Browse files
components/editor/main/hooks/useRequest.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const useRequest = (method: "post" | "put" | "patch" | "delete" | "get",
|
|
| 28 |
|
| 29 |
const needBody = ["post", "put", "patch"].includes(method);
|
| 30 |
|
| 31 |
-
const formattedBody = Object
|
| 32 |
if (key.includes(".")) {
|
| 33 |
const [first, ...rest] = key.split(".");
|
| 34 |
acc[first] = {
|
|
@@ -40,9 +40,8 @@ export const useRequest = (method: "post" | "put" | "patch" | "delete" | "get",
|
|
| 40 |
}
|
| 41 |
return acc;
|
| 42 |
}
|
| 43 |
-
, {});
|
| 44 |
|
| 45 |
-
console.log(formattedBody);
|
| 46 |
|
| 47 |
axios[method](url.pathname, needBody ? formattedBody : {
|
| 48 |
data: method === "delete" ? formattedBody : undefined,
|
|
|
|
| 28 |
|
| 29 |
const needBody = ["post", "put", "patch"].includes(method);
|
| 30 |
|
| 31 |
+
const formattedBody = body ? Object?.entries(body as any).reduce((acc: any, [key, value]) => {
|
| 32 |
if (key.includes(".")) {
|
| 33 |
const [first, ...rest] = key.split(".");
|
| 34 |
acc[first] = {
|
|
|
|
| 40 |
}
|
| 41 |
return acc;
|
| 42 |
}
|
| 43 |
+
, {}) : undefined;
|
| 44 |
|
|
|
|
| 45 |
|
| 46 |
axios[method](url.pathname, needBody ? formattedBody : {
|
| 47 |
data: method === "delete" ? formattedBody : undefined,
|
public/banner.png
ADDED
|