@ditojs/admin 1.11.0 → 1.12.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/admin",
@@ -35,8 +35,8 @@
35
35
  "not ie_mob > 0"
36
36
  ],
37
37
  "dependencies": {
38
- "@ditojs/ui": "^1.11.0",
39
- "@ditojs/utils": "^1.11.0",
38
+ "@ditojs/ui": "^1.12.0",
39
+ "@ditojs/utils": "^1.12.0",
40
40
  "codeflask": "^1.4.1",
41
41
  "filesize": "^10.0.5",
42
42
  "filesize-parser": "^1.5.0",
@@ -58,11 +58,11 @@
58
58
  "vuedraggable": "^2.24.3"
59
59
  },
60
60
  "devDependencies": {
61
- "@ditojs/build": "^1.11.0",
61
+ "@ditojs/build": "^1.12.0",
62
62
  "pug": "^3.0.2",
63
63
  "sass": "1.55.0",
64
64
  "vite": "^3.2.2",
65
65
  "vite-plugin-vue2": "^2.0.2"
66
66
  },
67
- "gitHead": "cc2a838ccf15a75f435844f3087698c4efaf44e4"
67
+ "gitHead": "3707045b72d84db4b5174d2efeb8cf62e2065ffa"
68
68
  }
package/src/DitoAdmin.js CHANGED
@@ -199,8 +199,8 @@ class RequestError extends Error {
199
199
  async function request(api, {
200
200
  url,
201
201
  method = 'get',
202
- // TODO: `params` was deprecated in favor of `query` on 2022-11-01, remove
203
- // once not in use anywhere anymore.
202
+ // TODO: `request.params` was deprecated in favor of `query` on 2022-11-01,
203
+ // remove once not in use anywhere anymore.
204
204
  params = null,
205
205
  query = params || null,
206
206
  headers = null,
@@ -231,7 +231,11 @@ async function request(api, {
231
231
  ? 'include'
232
232
  : 'same-origin'
233
233
  })
234
- response.data = await response.json()
234
+
235
+ if (response.headers.get('Content-Type')?.includes('application/json')) {
236
+ response.data = await response.json()
237
+ }
238
+
235
239
  if (!response.ok) {
236
240
  throw new RequestError(response)
237
241
  }
@@ -334,7 +334,9 @@ export default {
334
334
  const cacheKey = loadCache && `${
335
335
  options.method || 'get'} ${
336
336
  options.url} ${
337
- JSON.stringify(options.params || '')} ${
337
+ // TODO: `request.params` was deprecated in favor of `query` on
338
+ // 2022-11-01, remove once not in use anywhere anymore.
339
+ JSON.stringify(options.query || options.params || '')} ${
338
340
  JSON.stringify(options.data || '')
339
341
  }`
340
342
  if (loadCache && (cacheKey in loadCache)) {