@datawheel/bespoke 0.3.4 → 0.3.6
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/dist/index.css +0 -249
- package/dist/index.js +1030 -804
- package/dist/server.js +6 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -28,6 +28,7 @@ import formidable from 'formidable';
|
|
|
28
28
|
import DomParser from 'dom-parser';
|
|
29
29
|
import axiosRetry from 'axios-retry';
|
|
30
30
|
import toposort from 'toposort';
|
|
31
|
+
import { csvParse } from 'd3-dsv';
|
|
31
32
|
import getConfig from 'next/config';
|
|
32
33
|
import { schema, normalize } from 'normalizr';
|
|
33
34
|
import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
@@ -4333,7 +4334,11 @@ async function apiFetch(url, settings, readMemberFn, locale = "en") {
|
|
|
4333
4334
|
timeout: apiFetchTimeout
|
|
4334
4335
|
});
|
|
4335
4336
|
if (response.status === 200) {
|
|
4336
|
-
|
|
4337
|
+
if (response.headers["content-type"] === "text/csv") {
|
|
4338
|
+
finalData = csvParse(response.data);
|
|
4339
|
+
} else {
|
|
4340
|
+
finalData = response.data;
|
|
4341
|
+
}
|
|
4337
4342
|
} else {
|
|
4338
4343
|
throw new ApiFetchException("No response");
|
|
4339
4344
|
}
|