@akinon/next 1.36.0-rc.1 → 1.36.0-rc.2
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/CHANGELOG.md +6 -0
- package/api/client.ts +18 -9
- package/data/client/account.ts +10 -9
- package/package.json +2 -2
- package/types/commerce/account.ts +1 -0
package/CHANGELOG.md
CHANGED
package/api/client.ts
CHANGED
|
@@ -78,12 +78,13 @@ async function proxyRequest(...args) {
|
|
|
78
78
|
fetchOptions.headers['Content-Type'] = options.contentType;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
const isMultipartFormData = req.headers.get('content-type')?.includes('multipart/form-data;');
|
|
82
|
+
|
|
81
83
|
if (req.method !== 'GET') {
|
|
82
|
-
|
|
83
|
-
let body = {};
|
|
84
|
+
let body: Record<string, any> | FormData = {};
|
|
84
85
|
|
|
85
86
|
try {
|
|
86
|
-
body = await req.json();
|
|
87
|
+
body = isMultipartFormData ? await req.formData() : await req.json();
|
|
87
88
|
} catch (error) {
|
|
88
89
|
logger.error(
|
|
89
90
|
`Client Proxy Request - Error while parsing request body to JSON`,
|
|
@@ -94,13 +95,21 @@ async function proxyRequest(...args) {
|
|
|
94
95
|
);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
if (isMultipartFormData) {
|
|
99
|
+
fetchOptions.body = body as FormData;
|
|
100
|
+
} else {
|
|
101
|
+
const formData = new FormData();
|
|
102
|
+
|
|
103
|
+
Object.keys(body ?? {}).forEach((key) => {
|
|
104
|
+
if (body[key]) {
|
|
105
|
+
formData.append(key, body[key]);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
fetchOptions.body = !options.useFormData
|
|
110
|
+
? JSON.stringify(body)
|
|
111
|
+
: formData;
|
|
112
|
+
}
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
|
package/data/client/account.ts
CHANGED
|
@@ -123,15 +123,16 @@ const accountApi = api.injectEndpoints({
|
|
|
123
123
|
query: ({ page, status, limit }) =>
|
|
124
124
|
buildClientRequestUrl(account.getQuotations(page, status, limit))
|
|
125
125
|
}),
|
|
126
|
-
sendContact: builder.mutation<void,
|
|
127
|
-
query: (body) =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
sendContact: builder.mutation<void, FormData>({
|
|
127
|
+
query: (body) => {
|
|
128
|
+
return {
|
|
129
|
+
url: buildClientRequestUrl(account.sendContact, {
|
|
130
|
+
useFormData: true
|
|
131
|
+
}),
|
|
132
|
+
method: 'POST',
|
|
133
|
+
body
|
|
134
|
+
};
|
|
135
|
+
}
|
|
135
136
|
}),
|
|
136
137
|
cancelOrder: builder.mutation<void, AccountOrderCancellation>({
|
|
137
138
|
query: ({ id, ...body }) => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.36.0-rc.
|
|
4
|
+
"version": "1.36.0-rc.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
36
36
|
"@typescript-eslint/parser": "6.7.4",
|
|
37
37
|
"eslint": "^8.14.0",
|
|
38
|
-
"@akinon/eslint-plugin-projectzero": "1.36.0-rc.
|
|
38
|
+
"@akinon/eslint-plugin-projectzero": "1.36.0-rc.2",
|
|
39
39
|
"eslint-config-prettier": "8.5.0"
|
|
40
40
|
}
|
|
41
41
|
}
|