|
1 | | -const { default: axios } = require('axios') |
| 1 | +const { httpClient } = require('./utils/httpClient') |
2 | 2 | const fs = require('fs') |
3 | 3 | const { sendDoM } = require('./utils/dom') |
4 | 4 | const { validateStorybookUrl, validateStorybookDir } = require('./utils/validate') |
@@ -27,7 +27,7 @@ async function storybook(serve, options) { |
27 | 27 | storybookConfig.browsers = (!storybookConfig.browsers.length) ? 'all' : storybookConfig.browsers.map(x => x.toLowerCase()).toString(); |
28 | 28 |
|
29 | 29 | // Get stories object from stories.json and add url corresponding to every story ID |
30 | | - await axios.get(new URL('stories.json', url).href) |
| 30 | + await httpClient.get(new URL('stories.json', url).href) |
31 | 31 | .then(async function (response) { |
32 | 32 | let stories = {} |
33 | 33 | for (const [storyId, storyInfo] of Object.entries(response.data.stories)) { |
@@ -101,7 +101,7 @@ async function storybook(serve, options) { |
101 | 101 | // Upload to S3 |
102 | 102 | const zipData = fs.readFileSync('storybook-static.zip'); |
103 | 103 | console.log('[smartui] Upload in progress...') |
104 | | - await axios.put(url, zipData, { |
| 104 | + await httpClient.put(url, zipData, { |
105 | 105 | headers: { |
106 | 106 | 'Content-Type': 'application/zip', |
107 | 107 | 'Content-Length': zipData.length |
@@ -183,7 +183,7 @@ async function storybook(serve, options) { |
183 | 183 | } |
184 | 184 |
|
185 | 185 | // Call static render API |
186 | | - await axios.post(new URL(constants[options.env].STATIC_RENDER_PATH, constants[options.env].BASE_URL).href, payload) |
| 186 | + await httpClient.post(new URL(constants[options.env].STATIC_RENDER_PATH, constants[options.env].BASE_URL).href, payload) |
187 | 187 | .then(async function (response) { |
188 | 188 | if (response.data && response.data.error) { |
189 | 189 | console.log('[smartui] Error: ', response.data.error.message); |
|
0 commit comments